This release is a pre-release and may not be stable for production use.
What is pyopenet?
PyOpenET is a python library for the OpenET API to ease the process of gathering data from OpenET. The flexibility of this library allows for small tasks to run safely, and this extends to massive jobs that span multiple years of data.
What is OpenET?
OpenET's slogan is "filling the biggest data gap in water management". Their mission goal is to securely deliver ET and groundwater data using an ensemble of well-established methods in a timely manner.
The documentation for the OpenET API can be found here
Main Features
ETRequest
The request module retrieves data from OpenET and performs output validation and timeout handling.
ETJob
RasterTimeseries
An implementation of the raster timeseries endpoint for point and polygon inputs. Inputs are structured in a RasterConfigSequence which allows the possibility of having a combination of inputs.
Installation
With pip
pip install pyopenet
With uv
uv add pyopenet
Usage
Currently, only RasterTimeseries is supported. A dedicated documentation page will be made when more features are implemented.
Field input data from OpenET is typically structured as a table containing three columns: field ID, USGS cropland ID, and a JSON string containing the geometric feature.
df = pd.read_csv("PATH/TO/INPUT.csv")
| OPENET_ID | CROP_2023 | .geo |
|---|---|---|
| CA_832174 | 63 | "{""type"": "Point", ""coordinates"": [98.819628, -192.0912796]}" |
If using input data in this format, the .geo column will cause problems since it will be interpreted as a string. The pyopenet.ETUtil module has a function parse_geo that will convert this column.
df['.geo'] = parse_geo(df['.geo'])
| OPENET_ID | CROP_2023 | .geo |
|---|---|---|
| CA_832174 | 63 | {"type": "Point", "coordinates": [98.819628, -192.0912796]} |
Now, the .geo column has values that are dicts instead of strings.
A job can be created from this DataFrame.
config = RasterConfigSequence(
interval="monthly",
model=["ensemble", "geesebal"],
reference_et="cimis",
variable=["eto", "et"],
file_format="json",
units="mm"
)
RasterConfigSequence will generate combinations of query parameters from what was provided.
The output DataFrame inherits the index from the input. So to pass the field and crop IDs into the output, set those columns as an index.
df = df.set_index(["OPENET_ID", "CROP_2023"])
Optionally, you can set this when you run the job, but currently this only supports one index.
job = ETJob.RasterTimeseries(
options=config,
api_key="YOUR_OPENET_API_KEY",
table=df, # <-- Your input data to iterate through.
geometry=".geo", # <-- Geometry column containing values of geometry features
index="OPENET_ID" # <-- Overwrites input data's index
)
job.run("2016-01-01", "2024-12-31") # <-- Collect data within this date range.
| OPENET_ID | CROP_2023 | date | model | variable | overpass | reference_et | units | value |
|---|---|---|---|---|---|---|---|---|
| CA_0 | 47 | 2023-06-01 | ensemble | et | False | cimis | mm | 0.12 |
| CA_1 | 62 | 2023-06-01 | ensemble | et | False | cimis | mm | 0.15 |
| CA_2 | 47 | 2023-06-01 | ensemble | et | False | cimis | mm | 0.13 |
This output is not reflective of the inputs. This is just an example.
This output dataframe can be exported through the builtin
job.export("PATH/TO/EXPORT.csv")
The output can be accessed directly for more control
job.get_table().to_csv("PATH/TO/EXPORT.csv")
Metadata
Release files for pyopenet 0.1.1b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyopenet-0.1.1b0.tar.gz | 33.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyopenet-0.1.1b0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.0 kB
Release files / pyopenet-0.1.1b0.tar.gz
| Download URL | pyopenet-0.1.1b0.tar.gz |
|---|---|
| Size | 33.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7888e86d5683435ea85587ee8004544fa632a64192c66a2d6132a27b615d9b5b
|
|
BLAKE2b-256 checksum How to use checksums |
2a2c1967de4e07510aada7176cb4ec17140d8653cf9aeb4c3ea7c60d9be55063
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.6
|
Release files / pyopenet-0.1.1b0-py3-none-any.whl
| Download URL | pyopenet-0.1.1b0-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d5c391d6ba127c46e01e92040789f6431bcb40d13ff8c9808669e7d2026ab963
|
|
BLAKE2b-256 checksum How to use checksums |
c8f29fb8a86bed5537bf2afc19245b19bca3cd44053ea66b25211493d32f7563
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.6
|