Skip to main content

EnvDataPrep: High-performance Environmental Data Pre-processing

Python License Development Status

Why EnvDataPrep?

EnvDataPrep aims to help environmental scientists overcome common challenges in handling environmental datasets, incluidng:

  • Insufficient disk space for massive datasets
  • Complex conversions between different file formats
  • Time-consuming geospatial operations
  • And more ...

EnvDataPrep is designed for high performance and syntax simplicity. By leveraging vectorized operations, parallelism, and industry-standard libraries like NumPy, Xarray, and netCDF4, it streamlines heavy and complex data preparation tasks into efficient and easy-to-use APIs.

Core Capacities

Currently, the main functionality is subsetting netCDF files. Typical satellite products (e.g., TROPOMI NO2) and model simulations (e.g., WRF outputs) can shrink by a large fraction (e.g., 90%) when you keep only the data fields you need.

Example of subsetting netCDF files

import glob
import os

import envdataprep as edp

# Directories
INPUT_DIR = "path/to/input/directory"
OUTPUT_DIR = "path/to/output/directory"

# Input files (using TROPOMI NO2 satellite products as an example)
input_files = glob.glob(os.path.join(INPUT_DIR, "S5P*.nc"))

# Explore all available variables
all_vars = edp.list_netcdf_vars(input_files[0])
print(*all_vars, sep="\n")

# Select the variables to keep
selected_vars = [
    "PRODUCT/latitude",
    "PRODUCT/longitude",
    "PRODUCT/time_utc",
    "PRODUCT/qa_value",
    "PRODUCT/nitrogendioxide_tropospheric_column",
    "PRODUCT/nitrogendioxide_tropospheric_column_precision",
    "PRODUCT/SUPPORT_DATA/GEOLOCATIONS/solar_zenith_angle",
    "PRODUCT/SUPPORT_DATA/GEOLOCATIONS/viewing_zenith_angle",
    "PRODUCT/SUPPORT_DATA/GEOLOCATIONS/latitude_bounds",
    "PRODUCT/SUPPORT_DATA/GEOLOCATIONS/longitude_bounds",
    "PRODUCT/SUPPORT_DATA/INPUT_DATA/surface_altitude",
    "PRODUCT/SUPPORT_DATA/INPUT_DATA/eastward_wind",
    "PRODUCT/SUPPORT_DATA/INPUT_DATA/northward_wind",
]

# Subset the netCDF files in parallel
edp.subset_netcdf(
    nc_input=input_files,
    output_dir=OUTPUT_DIR,
    keep_vars=selected_vars,
    workers=8,
)

Installation

Requirements: Python 3.12+.

Install from PyPI:

pip install envdataprep

⚠️ Disclaimer

Due to the massive scale and inherent diversity of environmental data, some edge cases may remain unexplored. For critical research or production workflows, it is strongly recommended to manually validate processed outputs.

If you encounter any discrepancies or unexpected behavior, please open an issue.

License

This project is licensed under the MIT License.

⬆ Back to top

Metadata

Release files for envdataprep 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for envdataprep 0.1.2
File Size Uploaded
envdataprep-0.1.2.tar.gz 16.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for envdataprep 0.1.2
File Interpreter ABI Platform
envdataprep-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 34.7 kB

Release files / envdataprep-0.1.2.tar.gz

Download URL envdataprep-0.1.2.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2bf04e397a9b2117d4401f1f0f9b1ad20eefed6e1b7510a9c678b25e4b6f161c
BLAKE2b-256 checksum
How to use checksums
f46acb00e3d098468241d555c597cc74c994bf2db7702ccd12cff9f8824eee8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / envdataprep-0.1.2-py3-none-any.whl

Download URL envdataprep-0.1.2-py3-none-any.whl
Size 18.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31691ad2eb05e6e3dd3e45cb71fe7eeff35fd7f8f313f5c3692c67c13cf26c40
BLAKE2b-256 checksum
How to use checksums
9bb7bb8d848da593416fac6321249a375870d5d298139c5100bb22a2c8059d5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page