Skip to main content

Convenience functions for working with HDF4-EOS datasets

Project description

Python Tools for EOS-HDF4 Format

Unfortunately, many important NASA datasets are still distributed as EOS-HDF4 granules. This small library may help you to avoid needing to install GDAL just to read the file. It is capable of reading an an HDF4 file (and EOS-HDF4 files, in particular) and writing out a spatial dataset using rasterio, based on some strict assumptions about the file-level attributes; assumptions that are usually satisfied by an EOS-HDF4 file.

The problems solved by py4eos include:

  • Reading an EOS-HDF4 file without needing GDAL installed
  • Figuring out the coordinate reference system (CRS) and affine transformation of an EOS-HDF4 granule
  • Converting an EOS-HDF4 file to a more convenient raster format

Example Use

import earthaccess
import py4eos

# Download a MOD16A3GF granule
result = earthaccess.search_data(
    short_name = 'MOD16A3GF',
    temporal = ('2014-01-01', '2014-12-31'),
    bounding_box = (-106, 42, -103, 43))
earthaccess.download(result, TEST_DIR)

# Write the file to a GeoTIFF
hdf = py4eos.read_hdf4eos(granule_mod16a3)
hdf.to_rasterio('ET_500m', 'output_file.tiff')

Installation

The easiest way to install py4eos is using mamba (see installation instructions) or conda. This is the recommended way to install py4eos on Windows or Mac OS X:

mamba install py4eos

If the HDF4, zlib, and libjpeg libraries are already installed, then you can use pip on any system to install py4eos:

pip install py4eos

Installing dependencies on GNU/Linux:

  • On Ubuntu GNU/Linux: sudo apt install python3-dev libhdf4-dev

Running the test suite, from the root directory of the repository:

python -m pytest

Because data has to be downloaded as part of running the tests, they may fail the first time. Try running once more.

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

py4eos-0.2.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

py4eos-0.2.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file py4eos-0.2.0.tar.gz.

File metadata

  • Download URL: py4eos-0.2.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for py4eos-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c907cec5620dbe73b8245849e18654ac0dfec433a74a9b3d0ab0874a3ab6d5ba
MD5 65bc7e8800098af83fc76985f0c99fe4
BLAKE2b-256 f2694a30a54b41ebd02c5a5085df3fce8897e53bd421d07a317c48cce23b0857

See more details on using hashes here.

File details

Details for the file py4eos-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: py4eos-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for py4eos-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa81a08316f66ebeed79053f7bd698cbeb4e78725ff6fc595855dd670252669f
MD5 4582ff9c41cc05ad408ed99244a04b18
BLAKE2b-256 967a55c77c0df8b9e32399738768dd0bf56fb0fa445e6ce6f501901b4bab9b8a

See more details on using hashes here.

Supported by

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