summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/odc-geo/default.nix
blob: 671d79881f05b318266ddc5896ae9445e4d3e35a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
{
  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.10";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "opendatacube";
    repo = "odc-geo";
    tag = "v${version}";
    hash = "sha256-f4wUUzcv4NM44zrCvW3sBRybppIBZEAm+oiTSW1B+Fw=";
  };

  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;

  disabledTestMarks = [ "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/releases/tag/${src.tag}";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ daspk04 ];
  };
}