{"id":23831961,"url":"https://github.com/csdms/bmi-geotiff","last_synced_at":"2026-01-21T23:09:27.900Z","repository":{"id":37253939,"uuid":"353130879","full_name":"csdms/bmi-geotiff","owner":"csdms","description":"Access data (and metadata) from a GeoTIFF file through a BMI","archived":false,"fork":false,"pushed_at":"2024-11-12T21:40:27.000Z","size":2237,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-12-13T02:09:10.343Z","etag":null,"topics":["bmi","csdms","geotiff","python"],"latest_commit_sha":null,"homepage":"https://bmi-geotiff.csdms.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csdms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-30T20:20:18.000Z","updated_at":"2024-11-22T18:44:40.000Z","dependencies_parsed_at":"2024-11-12T22:21:33.473Z","dependency_job_id":"19b1f9b6-b0f4-415c-b53b-37cf6069e541","html_url":"https://github.com/csdms/bmi-geotiff","commit_stats":{"total_commits":71,"total_committers":1,"mean_commits":71.0,"dds":0.0,"last_synced_commit":"f96b5a624a711b977cc11ce71b159eb684cbc638"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-geotiff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-geotiff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-geotiff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csdms%2Fbmi-geotiff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csdms","download_url":"https://codeload.github.com/csdms/bmi-geotiff/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232206387,"owners_count":18488512,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bmi","csdms","geotiff","python"],"created_at":"2025-01-02T14:16:45.299Z","updated_at":"2026-01-21T23:09:27.892Z","avatar_url":"https://github.com/csdms.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4721474.svg)](https://doi.org/10.5281/zenodo.4721474)\n[![PyPI](https://img.shields.io/pypi/v/bmi-geotiff)](https://pypi.org/project/bmi-geotiff)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/bmi-geotiff.svg)](https://anaconda.org/conda-forge/bmi-geotiff)\n[![Test](https://github.com/csdms/bmi-geotiff/actions/workflows/test.yml/badge.svg)](https://github.com/csdms/bmi-geotiff/actions/workflows/test.yml)\n[![Documentation Status](https://readthedocs.org/projects/bmi-geotiff/badge/?version=latest)](https://bmi-geotiff.csdms.io/en/latest/?badge=latest)\n\n# bmi-geotiff\n\nAccess data (and metadata) from a GeoTIFF file through an API or a BMI.\n\nThe *bmi-geotiff* library accepts a filepath or an URL to a GeoTIFF file.\nData are loaded into an\n[xarray](http://xarray.pydata.org/en/stable/)\n[DataArray](http://xarray.pydata.org/en/stable/api.html#dataarray)\nusing the [rioxarray](https://corteva.github.io/rioxarray/stable/index.html)\n[open_rasterio](https://corteva.github.io/rioxarray/stable/rioxarray.html#rioxarray.open_rasterio) method.\nThe API is wrapped with a\n[Basic Model Interface](https://bmi.csdms.io) (BMI),\nwhich provides a standard set of functions for coupling with data or models\nthat also expose a BMI.\nMore information on the BMI can found in its\n[documentation](https://bmi.csdms.io).\n\n## Installation\n\nInstall the latest stable release of *bmi-geotiff* with `pip`:\n```\npip install bmi-geotiff\n```\nor with `conda`:\n```\nconda install -c conda-forge bmi-geotiff\n```\n\nAlternately,\nthe *bmi-geotiff* library can be built and installed from source.\nThe library uses several other open source libraries,\nso a convenient way of building and installing it is within a\n[conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html).\nAfter cloning or downloading the *bmi-geotiff*\n[repository](https://github.com/csdms/bmi-geotiff),\nchange into the repository directory\nand set up a conda environment with the included environment file:\n```\nconda env create --file environment.yml\n```\nThen build and install *bmi-geotiff* from source with\n```\npip install -e .\n```\n\n## Examples\n\nA brief example of using the *bmi-geotiff* API is given in the following steps.\nThe example is derived from a [similar example](http://xarray.pydata.org/en/stable/examples/visualization_gallery.html#imshow()-and-rasterio-map-projections) in the xarray documentation.\n\nStart a Python session and import the `GeoTiff` class:\n```python\n\u003e\u003e\u003e from bmi_geotiff import GeoTiff\n```\n\nFor convenience,\nlet's use a test image from the [rasterio](https://rasterio.readthedocs.io) project:\n```python\n\u003e\u003e\u003e url = \"https://github.com/rasterio/rasterio/raw/main/tests/data/RGB.byte.tif\"\n```\n\nMake an instance of `GeoTiff` with this URL:\n```python\n\u003e\u003e\u003e g = GeoTiff(url)\n```\nThis step might take a few moments as the data are pulled from GitHub.\n\nThe data have been loaded into an xarray `DataArray`, which can be accessed through the `da` property:\n```python\n\u003e\u003e\u003e g.da\n\u003cxarray.DataArray (band: 3, y: 718, x: 791)\u003e\n[1703814 values with dtype=uint8]\nCoordinates:\n  * band         (band) int64 1 2 3\n  * x            (x) float64 1.021e+05 1.024e+05 ... 3.389e+05 3.392e+05\n  * y            (y) float64 2.827e+06 2.826e+06 ... 2.612e+06 2.612e+06\n    spatial_ref  int64 0\nAttributes:\n    STATISTICS_MAXIMUM:  255\n    STATISTICS_MEAN:     29.947726688477\n    STATISTICS_MINIMUM:  0\n    STATISTICS_STDDEV:   52.340921626611\n    _FillValue:          0.0\n    scale_factor:        1.0\n    add_offset:          0.0\n    units:               metre\n```\n\nNote that coordinate reference system information is stored\nin the `spatial_ref` non-dimensional coordinate:\n```python\n\u003e\u003e\u003e g.da.spatial_ref\n\u003cxarray.DataArray 'spatial_ref' ()\u003e\narray(0)\nCoordinates:\n    spatial_ref  int64 0\nAttributes:\n    crs_wkt:                           PROJCS[\"WGS 84 / UTM zone 18N\",GEOGCS[...\n    semi_major_axis:                   6378137.0\n    semi_minor_axis:                   6356752.314245179\n    inverse_flattening:                298.257223563\n    reference_ellipsoid_name:          WGS 84\n    longitude_of_prime_meridian:       0.0\n    prime_meridian_name:               Greenwich\n    geographic_crs_name:               WGS 84\n    horizontal_datum_name:             World Geodetic System 1984\n    projected_crs_name:                WGS 84 / UTM zone 18N\n    grid_mapping_name:                 transverse_mercator\n    latitude_of_projection_origin:     0.0\n    longitude_of_central_meridian:     -75.0\n    false_easting:                     500000.0\n    false_northing:                    0.0\n    scale_factor_at_central_meridian:  0.9996\n    spatial_ref:                       PROJCS[\"WGS 84 / UTM zone 18N\",GEOGCS[...\n    GeoTransform:                      101985.0 300.0379266750948 0.0 2826915...\n```\n\nDisplay the image with the [xarray.plot.imshow](http://xarray.pydata.org/en/stable/generated/xarray.plot.imshow.html) method.\n```python\n\u003e\u003e\u003e import matplotlib.pyplot as plt\n\u003e\u003e\u003e g.da.plot.imshow()\n\u003e\u003e\u003e plt.show()\n```\n\n![Example GeoTiff display through *xarray*.](./examples/example-rgb.png)\n\nFor examples with more detail,\nsee the Jupyter Notebooks and Python scripts\nincluded in the [examples](https://github.com/csdms/bmi-geotiff/tree/main/examples) directory\nof the *bmi-geotiff* repository.\n\n\u003c!-- skip-docs-link --\u003e\n\nDocumentation for *bmi-geotiff*\nis available at https://bmi-geotiff.csdms.io.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsdms%2Fbmi-geotiff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsdms%2Fbmi-geotiff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsdms%2Fbmi-geotiff/lists"}