diff --git a/pkgs/development/python-modules/odc-geo/default.nix b/pkgs/development/python-modules/odc-geo/default.nix new file mode 100644 index 000000000000..922b1aeb21bc --- /dev/null +++ b/pkgs/development/python-modules/odc-geo/default.nix @@ -0,0 +1,117 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + + # dependencies + affine, + cachetools, + numpy, + pyproj, + shapely, + + # optional-dependencies + azure-storage-blob, + boto3, + dask, + distributed, + rasterio, + tifffile, + xarray, + + # tests + geopandas, + matplotlib, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "odc-geo"; + version = "0.4.9"; + pyproject = true; + + src = fetchFromGitHub { + owner = "opendatacube"; + repo = "odc-geo"; + tag = "v${version}"; + hash = "sha256-7OhXx+lPvZSHP+aP3ucIkVBvW5De0FLNa+azc3Ar050="; + }; + + build-system = [ + setuptools + ]; + + dependencies = [ + affine + cachetools + numpy + pyproj + shapely + ]; + + optional-dependencies = { + xr = [ xarray ]; + wrap = [ rasterio ]; + tiff = [ + dask + distributed + rasterio + tifffile + xarray + ]; + s3 = [ boto3 ]; + az = [ azure-storage-blob ]; + all = [ + azure-storage-blob + boto3 + dask + distributed + rasterio + tifffile + xarray + ]; + }; + + nativeCheckInputs = [ + geopandas + matplotlib + pytestCheckHook + ] ++ optional-dependencies.all; + + pytestFlagsArray = [ "-m 'not network'" ]; + + disabledTests = [ + # AttributeError (fixes: https://github.com/opendatacube/odc-geo/pull/202) + "test_azure_multipart_upload" + # network access + "test_empty_cog" + # urllib url open error + "test_country_geom" + "test_from_geopandas" + "test_geoboxtiles_intersect" + "test_warp_nan" + # requires imagecodecs package (currently not available on nixpkgs) + "test_cog_with_dask_smoke_test" + ]; + + pythonImportsCheck = [ + "odc.geo" + "odc.geo.xr" + ]; + + meta = { + description = "GeoBox and geometry utilities extracted from datacube-core"; + longDescription = '' + This library combines geometry shape classes from `shapely` with CRS from + `pyproj` to provide a number of data types and utilities useful for working + with geospatial metadata and geo-registered `xarray` rasters. + ''; + homepage = "https://github.com/opendatacube/odc-geo/"; + changelog = "https://github.com/opendatacube/odc-geo/tag/v${version}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ daspk04 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 618d4192a534..6bee9258fbdc 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9650,6 +9650,8 @@ self: super: with self; { od = callPackage ../development/python-modules/od { }; + odc-geo = callPackage ../development/python-modules/odc-geo { }; + oddsprout = callPackage ../development/python-modules/oddsprout { }; odfpy = callPackage ../development/python-modules/odfpy { };