Skip to main content

Retrieve mass amounts of data from OpenET with ease

Project description

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")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyopenet-0.1.1b0.tar.gz (33.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyopenet-0.1.1b0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file pyopenet-0.1.1b0.tar.gz.

File metadata

  • Download URL: pyopenet-0.1.1b0.tar.gz
  • Upload date:
  • Size: 33.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for pyopenet-0.1.1b0.tar.gz
Algorithm Hash digest
SHA256 7888e86d5683435ea85587ee8004544fa632a64192c66a2d6132a27b615d9b5b
MD5 63b59a8ddb35e08f49df4a6af16b136f
BLAKE2b-256 2a2c1967de4e07510aada7176cb4ec17140d8653cf9aeb4c3ea7c60d9be55063

See more details on using hashes here.

File details

Details for the file pyopenet-0.1.1b0-py3-none-any.whl.

File metadata

  • Download URL: pyopenet-0.1.1b0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.6

File hashes

Hashes for pyopenet-0.1.1b0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5c391d6ba127c46e01e92040789f6431bcb40d13ff8c9808669e7d2026ab963
MD5 83d2f435bf6d04dfe727591f9e44728e
BLAKE2b-256 c8f29fb8a86bed5537bf2afc19245b19bca3cd44053ea66b25211493d32f7563

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page