rioxarray 0.14.1__tar.gz → 0.15.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rioxarray-0.14.1 → rioxarray-0.15.1}/AUTHORS.rst +1 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/CONTRIBUTING.rst +1 -1
- {rioxarray-0.14.1/rioxarray.egg-info → rioxarray-0.15.1}/PKG-INFO +52 -5
- {rioxarray-0.14.1 → rioxarray-0.15.1}/README.rst +1 -1
- {rioxarray-0.14.1 → rioxarray-0.15.1}/pyproject.toml +1 -1
- rioxarray-0.15.1/rioxarray/__init__.py +19 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/_io.py +40 -34
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/raster_array.py +34 -28
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/raster_dataset.py +8 -4
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/raster_writer.py +2 -2
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/rioxarray.py +29 -26
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/xarray_plugin.py +4 -7
- {rioxarray-0.14.1 → rioxarray-0.15.1/rioxarray.egg-info}/PKG-INFO +52 -5
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray.egg-info/requires.txt +4 -4
- {rioxarray-0.14.1 → rioxarray-0.15.1}/setup.cfg +7 -7
- rioxarray-0.14.1/rioxarray/__init__.py +0 -11
- {rioxarray-0.14.1 → rioxarray-0.15.1}/LICENSE +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/LICENSE_datacube +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/LICENSE_xarray +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/MANIFEST.in +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/_options.py +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/_show_versions.py +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/crs.py +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/exceptions.py +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/merge.py +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray/py.typed +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray.egg-info/SOURCES.txt +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray.egg-info/dependency_links.txt +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray.egg-info/entry_points.txt +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray.egg-info/not-zip-safe +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/rioxarray.egg-info/top_level.txt +0 -0
- {rioxarray-0.14.1 → rioxarray-0.15.1}/setup.py +0 -0
|
@@ -54,6 +54,7 @@ Thanks goes to these wonderful people (`emoji key <https://allcontributors.org/d
|
|
|
54
54
|
<td align="center"><a href="https://github.com/stefank0"><img src="https://avatars.githubusercontent.com/u/32932217?v=4?s=100" width="100px;" alt=""/><br /><sub><b>stefank0</b></sub></a><br /><a href="https://github.com/corteva/rioxarray/commits?author=stefank0" title="Documentation">📖</a></td>
|
|
55
55
|
<td align="center"><a href="https://itcarroll.github.io/"><img src="https://avatars.githubusercontent.com/u/3383837?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ian Carroll</b></sub></a><br /><a href="#maintenance-itcarroll" title="Maintenance">🚧</a></td>
|
|
56
56
|
<td align="center"><a href="https://github.com/yvonnefroehlich"><img src="https://avatars.githubusercontent.com/u/94163266?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yvonne Fröhlich</b></sub></a><br /><a href="https://github.com/corteva/rioxarray/commits?author=yvonnefroehlich" title="Documentation">📖</a></td>
|
|
57
|
+
<td align="center"><a href="https://github.com/Kirill888"><img src="https://avatars.githubusercontent.com/u/1428024?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kirill Kouzoubov</b></sub></a><br /><a href="https://github.com/corteva/rioxarray/commits?author=Kirill888" title="Code">💻</a></td>
|
|
57
58
|
</tr>
|
|
58
59
|
</table>
|
|
59
60
|
|
|
@@ -135,7 +135,7 @@ Before you submit a pull request, check that it meets these guidelines:
|
|
|
135
135
|
2. If the pull request adds functionality, the docs should be updated. Put
|
|
136
136
|
your new functionality into a function with a docstring, and add the
|
|
137
137
|
feature to the list in README.rst.
|
|
138
|
-
3. The pull request should work for Python 3.
|
|
138
|
+
3. The pull request should work for Python 3.10-3.12.
|
|
139
139
|
|
|
140
140
|
Tips
|
|
141
141
|
----
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rioxarray
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.15.1
|
|
4
4
|
Summary: geospatial xarray extension powered by rasterio
|
|
5
5
|
Home-page: https://github.com/corteva/rioxarray
|
|
6
6
|
Download-URL: http://python.org/pypi/rioxarray
|
|
@@ -15,20 +15,67 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
17
17
|
Classifier: Programming Language :: Python
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Programming Language :: Python :: 3
|
|
22
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
23
|
Classifier: Typing :: Typed
|
|
24
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
25
|
Description-Content-Type: text/x-rst
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: packaging
|
|
28
|
+
Requires-Dist: rasterio>=1.3
|
|
29
|
+
Requires-Dist: xarray>=2022.3.0
|
|
30
|
+
Requires-Dist: pyproj>=3.3
|
|
31
|
+
Requires-Dist: numpy>=1.23
|
|
26
32
|
Provides-Extra: interp
|
|
33
|
+
Requires-Dist: scipy; extra == "interp"
|
|
27
34
|
Provides-Extra: doc
|
|
35
|
+
Requires-Dist: sphinx-click; extra == "doc"
|
|
36
|
+
Requires-Dist: nbsphinx; extra == "doc"
|
|
37
|
+
Requires-Dist: sphinx_rtd_theme; extra == "doc"
|
|
28
38
|
Provides-Extra: test
|
|
39
|
+
Requires-Dist: pytest>=3.6; extra == "test"
|
|
40
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
41
|
+
Requires-Dist: pytest-timeout; extra == "test"
|
|
42
|
+
Requires-Dist: dask; extra == "test"
|
|
43
|
+
Requires-Dist: netcdf4; extra == "test"
|
|
29
44
|
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: scipy; extra == "dev"
|
|
46
|
+
Requires-Dist: sphinx-click; extra == "dev"
|
|
47
|
+
Requires-Dist: nbsphinx; extra == "dev"
|
|
48
|
+
Requires-Dist: sphinx_rtd_theme; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest>=3.6; extra == "dev"
|
|
50
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
51
|
+
Requires-Dist: pytest-timeout; extra == "dev"
|
|
52
|
+
Requires-Dist: dask; extra == "dev"
|
|
53
|
+
Requires-Dist: netcdf4; extra == "dev"
|
|
54
|
+
Requires-Dist: pylint; extra == "dev"
|
|
55
|
+
Requires-Dist: mypy; extra == "dev"
|
|
56
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
30
57
|
Provides-Extra: all
|
|
31
|
-
|
|
58
|
+
Requires-Dist: scipy; extra == "all"
|
|
59
|
+
Requires-Dist: sphinx-click; extra == "all"
|
|
60
|
+
Requires-Dist: nbsphinx; extra == "all"
|
|
61
|
+
Requires-Dist: sphinx_rtd_theme; extra == "all"
|
|
62
|
+
Requires-Dist: pytest>=3.6; extra == "all"
|
|
63
|
+
Requires-Dist: pytest-cov; extra == "all"
|
|
64
|
+
Requires-Dist: pytest-timeout; extra == "all"
|
|
65
|
+
Requires-Dist: dask; extra == "all"
|
|
66
|
+
Requires-Dist: netcdf4; extra == "all"
|
|
67
|
+
Requires-Dist: scipy; extra == "all"
|
|
68
|
+
Requires-Dist: sphinx-click; extra == "all"
|
|
69
|
+
Requires-Dist: nbsphinx; extra == "all"
|
|
70
|
+
Requires-Dist: sphinx_rtd_theme; extra == "all"
|
|
71
|
+
Requires-Dist: pytest>=3.6; extra == "all"
|
|
72
|
+
Requires-Dist: pytest-cov; extra == "all"
|
|
73
|
+
Requires-Dist: pytest-timeout; extra == "all"
|
|
74
|
+
Requires-Dist: dask; extra == "all"
|
|
75
|
+
Requires-Dist: netcdf4; extra == "all"
|
|
76
|
+
Requires-Dist: pylint; extra == "all"
|
|
77
|
+
Requires-Dist: mypy; extra == "all"
|
|
78
|
+
Requires-Dist: pre-commit; extra == "all"
|
|
32
79
|
|
|
33
80
|
================
|
|
34
81
|
rioxarray README
|
|
@@ -41,7 +88,7 @@ rasterio xarray extension.
|
|
|
41
88
|
:alt: Join the chat at https://gitter.im/rioxarray/community
|
|
42
89
|
:target: https://gitter.im/rioxarray/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
|
43
90
|
|
|
44
|
-
.. image:: https://img.shields.io/badge/all_contributors-
|
|
91
|
+
.. image:: https://img.shields.io/badge/all_contributors-35-orange.svg?style=flat-square
|
|
45
92
|
:alt: All Contributors
|
|
46
93
|
:target: https://github.com/corteva/rioxarray/blob/master/AUTHORS.rst
|
|
47
94
|
|
|
@@ -9,7 +9,7 @@ rasterio xarray extension.
|
|
|
9
9
|
:alt: Join the chat at https://gitter.im/rioxarray/community
|
|
10
10
|
:target: https://gitter.im/rioxarray/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
|
11
11
|
|
|
12
|
-
.. image:: https://img.shields.io/badge/all_contributors-
|
|
12
|
+
.. image:: https://img.shields.io/badge/all_contributors-35-orange.svg?style=flat-square
|
|
13
13
|
:alt: All Contributors
|
|
14
14
|
:target: https://github.com/corteva/rioxarray/blob/master/AUTHORS.rst
|
|
15
15
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Top-level package for rioxarray."""
|
|
2
|
+
__author__ = """rioxarray Contributors"""
|
|
3
|
+
import importlib.metadata
|
|
4
|
+
|
|
5
|
+
import rioxarray.raster_array # noqa
|
|
6
|
+
import rioxarray.raster_dataset # noqa
|
|
7
|
+
from rioxarray._io import open_rasterio
|
|
8
|
+
from rioxarray._options import set_options
|
|
9
|
+
from rioxarray._show_versions import show_versions
|
|
10
|
+
|
|
11
|
+
__version__ = importlib.metadata.version(__package__)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"open_rasterio",
|
|
15
|
+
"set_options",
|
|
16
|
+
"show_versions",
|
|
17
|
+
"__author__",
|
|
18
|
+
"__version__",
|
|
19
|
+
]
|
|
@@ -17,7 +17,7 @@ from collections import defaultdict
|
|
|
17
17
|
from collections.abc import Hashable, Iterable
|
|
18
18
|
from typing import Any, Optional, Union
|
|
19
19
|
|
|
20
|
-
import numpy
|
|
20
|
+
import numpy
|
|
21
21
|
import rasterio
|
|
22
22
|
from numpy.typing import NDArray
|
|
23
23
|
from packaging import version
|
|
@@ -171,11 +171,11 @@ def _get_unsigned_dtype(unsigned, dtype):
|
|
|
171
171
|
"""
|
|
172
172
|
Based on: https://github.com/pydata/xarray/blob/abe1e613a96b000ae603c53d135828df532b952e/xarray/coding/variables.py#L306-L334
|
|
173
173
|
"""
|
|
174
|
-
dtype =
|
|
174
|
+
dtype = numpy.dtype(dtype)
|
|
175
175
|
if unsigned is True and dtype.kind == "i":
|
|
176
|
-
return
|
|
176
|
+
return numpy.dtype(f"u{dtype.itemsize}")
|
|
177
177
|
if unsigned is False and dtype.kind == "u":
|
|
178
|
-
return
|
|
178
|
+
return numpy.dtype(f"i{dtype.itemsize}")
|
|
179
179
|
return None
|
|
180
180
|
|
|
181
181
|
|
|
@@ -314,7 +314,7 @@ class RasterioArrayWrapper(BackendArray):
|
|
|
314
314
|
self._unsigned_dtype = None
|
|
315
315
|
self._fill_value = riods.nodata
|
|
316
316
|
dtypes = riods.dtypes
|
|
317
|
-
if not
|
|
317
|
+
if not numpy.all(numpy.asarray(dtypes) == dtypes[0]):
|
|
318
318
|
raise ValueError("All bands should have the same dtype")
|
|
319
319
|
|
|
320
320
|
dtype = _rasterio_to_numpy_dtype(dtypes)
|
|
@@ -385,9 +385,9 @@ class RasterioArrayWrapper(BackendArray):
|
|
|
385
385
|
# bands (axis=0) cannot be windowed but they can be listed
|
|
386
386
|
if isinstance(band_key, slice):
|
|
387
387
|
start, stop, step = band_key.indices(self.shape[0])
|
|
388
|
-
band_key =
|
|
388
|
+
band_key = numpy.arange(start, stop, step)
|
|
389
389
|
# be sure we give out a list
|
|
390
|
-
band_key = (
|
|
390
|
+
band_key = (numpy.asarray(band_key) + 1).tolist()
|
|
391
391
|
if isinstance(band_key, list): # if band_key is not a scalar
|
|
392
392
|
np_inds.append(slice(None))
|
|
393
393
|
|
|
@@ -406,13 +406,13 @@ class RasterioArrayWrapper(BackendArray):
|
|
|
406
406
|
start = ikey
|
|
407
407
|
stop = ikey + 1
|
|
408
408
|
else:
|
|
409
|
-
start, stop =
|
|
409
|
+
start, stop = numpy.min(ikey), numpy.max(ikey) + 1
|
|
410
410
|
np_inds.append(ikey - start)
|
|
411
411
|
window.append((start, stop))
|
|
412
412
|
|
|
413
|
-
if isinstance(key[1],
|
|
413
|
+
if isinstance(key[1], numpy.ndarray) and isinstance(key[2], numpy.ndarray):
|
|
414
414
|
# do outer-style indexing
|
|
415
|
-
np_inds[-2:] =
|
|
415
|
+
np_inds[-2:] = numpy.ix_(*np_inds[-2:])
|
|
416
416
|
|
|
417
417
|
return band_key, tuple(window), tuple(squeeze_axis), tuple(np_inds)
|
|
418
418
|
|
|
@@ -421,7 +421,7 @@ class RasterioArrayWrapper(BackendArray):
|
|
|
421
421
|
if not band_key or any(start == stop for (start, stop) in window):
|
|
422
422
|
# no need to do IO
|
|
423
423
|
shape = (len(band_key),) + tuple(stop - start for (start, stop) in window)
|
|
424
|
-
out =
|
|
424
|
+
out = numpy.zeros(shape, dtype=self.dtype)
|
|
425
425
|
else:
|
|
426
426
|
with self.lock:
|
|
427
427
|
riods = _ensure_warped_vrt(
|
|
@@ -431,7 +431,7 @@ class RasterioArrayWrapper(BackendArray):
|
|
|
431
431
|
if self._unsigned_dtype is not None:
|
|
432
432
|
out = out.astype(self._unsigned_dtype)
|
|
433
433
|
if self.masked:
|
|
434
|
-
out =
|
|
434
|
+
out = numpy.ma.filled(out.astype(self.dtype), self.fill_value)
|
|
435
435
|
if self.mask_and_scale:
|
|
436
436
|
if not isinstance(band_key, Iterable):
|
|
437
437
|
out = (
|
|
@@ -439,14 +439,14 @@ class RasterioArrayWrapper(BackendArray):
|
|
|
439
439
|
+ riods.offsets[band_key - 1]
|
|
440
440
|
)
|
|
441
441
|
else:
|
|
442
|
-
for iii, band_iii in enumerate(
|
|
442
|
+
for iii, band_iii in enumerate(numpy.atleast_1d(band_key) - 1):
|
|
443
443
|
out[iii] = (
|
|
444
444
|
out[iii] * riods.scales[band_iii]
|
|
445
445
|
+ riods.offsets[band_iii]
|
|
446
446
|
)
|
|
447
447
|
|
|
448
448
|
if squeeze_axis:
|
|
449
|
-
out =
|
|
449
|
+
out = numpy.squeeze(out, axis=squeeze_axis)
|
|
450
450
|
return out[np_inds]
|
|
451
451
|
|
|
452
452
|
def __getitem__(self, key):
|
|
@@ -475,7 +475,7 @@ def _parse_envi(meta):
|
|
|
475
475
|
"""
|
|
476
476
|
|
|
477
477
|
def parsevec(value):
|
|
478
|
-
return
|
|
478
|
+
return numpy.fromstring(value.strip("{}"), dtype="float", sep=",")
|
|
479
479
|
|
|
480
480
|
def default(value):
|
|
481
481
|
return value.strip("{}")
|
|
@@ -487,11 +487,11 @@ def _parse_envi(meta):
|
|
|
487
487
|
|
|
488
488
|
def _rasterio_to_numpy_dtype(dtypes):
|
|
489
489
|
"""Numpy dtype from first entry of rasterio dataset.dtypes"""
|
|
490
|
-
# rasterio has some special dtype names (complex_int16 ->
|
|
490
|
+
# rasterio has some special dtype names (complex_int16 -> numpy.complex64)
|
|
491
491
|
if dtypes[0] == "complex_int16":
|
|
492
|
-
dtype =
|
|
492
|
+
dtype = numpy.dtype("complex64")
|
|
493
493
|
else:
|
|
494
|
-
dtype =
|
|
494
|
+
dtype = numpy.dtype(dtypes[0])
|
|
495
495
|
|
|
496
496
|
return dtype
|
|
497
497
|
|
|
@@ -515,7 +515,7 @@ def _parse_tag(key: str, value: Any) -> tuple[str, Any]:
|
|
|
515
515
|
key = key.split("NC_GLOBAL#")[-1]
|
|
516
516
|
if value.startswith("{") and value.endswith("}"):
|
|
517
517
|
try:
|
|
518
|
-
new_val =
|
|
518
|
+
new_val = numpy.fromstring(value.strip("{}"), dtype="float", sep=",")
|
|
519
519
|
# pylint: disable=len-as-condition
|
|
520
520
|
value = new_val if len(new_val) else _to_numeric(value)
|
|
521
521
|
except ValueError:
|
|
@@ -535,17 +535,17 @@ def _parse_tags(tags: dict) -> dict:
|
|
|
535
535
|
|
|
536
536
|
NETCDF_DTYPE_MAP = {
|
|
537
537
|
0: object, # NC_NAT
|
|
538
|
-
1:
|
|
539
|
-
2:
|
|
540
|
-
3:
|
|
541
|
-
4:
|
|
538
|
+
1: numpy.byte, # NC_BYTE
|
|
539
|
+
2: numpy.char, # NC_CHAR
|
|
540
|
+
3: numpy.short, # NC_SHORT
|
|
541
|
+
4: numpy.int_, # NC_INT, NC_LONG
|
|
542
542
|
5: float, # NC_FLOAT
|
|
543
|
-
6:
|
|
544
|
-
7:
|
|
545
|
-
8:
|
|
546
|
-
9:
|
|
547
|
-
10:
|
|
548
|
-
11:
|
|
543
|
+
6: numpy.double, # NC_DOUBLE
|
|
544
|
+
7: numpy.ubyte, # NC_UBYTE
|
|
545
|
+
8: numpy.ushort, # NC_USHORT
|
|
546
|
+
9: numpy.uint, # NC_UINT
|
|
547
|
+
10: numpy.int64, # NC_INT64
|
|
548
|
+
11: numpy.uint64, # NC_UINT64
|
|
549
549
|
12: object, # NC_STRING
|
|
550
550
|
}
|
|
551
551
|
|
|
@@ -581,7 +581,7 @@ def _parse_netcdf_attr_array(attr: Union[NDArray, str], dtype=None) -> NDArray:
|
|
|
581
581
|
value = [attr]
|
|
582
582
|
else:
|
|
583
583
|
value = attr
|
|
584
|
-
return
|
|
584
|
+
return numpy.array(value, dtype=dtype)
|
|
585
585
|
|
|
586
586
|
|
|
587
587
|
def _load_netcdf_1d_coords(tags: dict) -> dict:
|
|
@@ -753,8 +753,8 @@ def _parse_driver_tags(
|
|
|
753
753
|
for key, value in meta.items():
|
|
754
754
|
# Add values as coordinates if they match the band count,
|
|
755
755
|
# as attributes otherwise
|
|
756
|
-
if isinstance(value, (list,
|
|
757
|
-
coords[key] = ("band",
|
|
756
|
+
if isinstance(value, (list, numpy.ndarray)) and len(value) == riods.count:
|
|
757
|
+
coords[key] = ("band", numpy.asarray(value))
|
|
758
758
|
else:
|
|
759
759
|
attrs[key] = value
|
|
760
760
|
|
|
@@ -1193,7 +1193,7 @@ def open_rasterio(
|
|
|
1193
1193
|
break
|
|
1194
1194
|
else:
|
|
1195
1195
|
coord_name = "band"
|
|
1196
|
-
coords[coord_name] =
|
|
1196
|
+
coords[coord_name] = numpy.asarray(riods.indexes)
|
|
1197
1197
|
|
|
1198
1198
|
has_gcps = riods.gcps[0]
|
|
1199
1199
|
if has_gcps:
|
|
@@ -1236,7 +1236,7 @@ def open_rasterio(
|
|
|
1236
1236
|
)
|
|
1237
1237
|
result.encoding = encoding
|
|
1238
1238
|
|
|
1239
|
-
# update attributes from NetCDF
|
|
1239
|
+
# update attributes from NetCDF attributes
|
|
1240
1240
|
_load_netcdf_attrs(riods.tags(), result)
|
|
1241
1241
|
result = _decode_datetime_cf(
|
|
1242
1242
|
result, decode_times=decode_times, decode_timedelta=decode_timedelta
|
|
@@ -1262,6 +1262,12 @@ def open_rasterio(
|
|
|
1262
1262
|
|
|
1263
1263
|
if chunks is not None:
|
|
1264
1264
|
result = _prepare_dask(result, riods, filename, chunks)
|
|
1265
|
+
else:
|
|
1266
|
+
result.encoding["preferred_chunks"] = {
|
|
1267
|
+
result.rio.y_dim: riods.block_shapes[0][0],
|
|
1268
|
+
result.rio.x_dim: riods.block_shapes[0][1],
|
|
1269
|
+
coord_name: 1,
|
|
1270
|
+
}
|
|
1265
1271
|
|
|
1266
1272
|
# add file path to encoding
|
|
1267
1273
|
result.encoding["source"] = riods.name
|
|
@@ -15,7 +15,7 @@ from collections.abc import Hashable, Iterable, Mapping
|
|
|
15
15
|
from pathlib import Path
|
|
16
16
|
from typing import Any, Literal, Optional, Union
|
|
17
17
|
|
|
18
|
-
import numpy
|
|
18
|
+
import numpy
|
|
19
19
|
import rasterio
|
|
20
20
|
import rasterio.mask
|
|
21
21
|
import rasterio.warp
|
|
@@ -170,9 +170,11 @@ def _clip_from_disk(
|
|
|
170
170
|
invert=invert,
|
|
171
171
|
crop=drop,
|
|
172
172
|
)
|
|
173
|
-
if xds.rio.encoded_nodata is not None and not
|
|
174
|
-
|
|
175
|
-
|
|
173
|
+
if xds.rio.encoded_nodata is not None and not numpy.isnan(
|
|
174
|
+
xds.rio.encoded_nodata
|
|
175
|
+
):
|
|
176
|
+
out_image = out_image.astype(numpy.float64)
|
|
177
|
+
out_image[out_image == xds.rio.encoded_nodata] = numpy.nan
|
|
176
178
|
|
|
177
179
|
height, width = out_image.shape[-2:]
|
|
178
180
|
cropped_ds = xarray.DataArray(
|
|
@@ -216,10 +218,10 @@ def _clip_xarray(
|
|
|
216
218
|
)
|
|
217
219
|
cropped_ds = cropped_ds.rio.isel_window(
|
|
218
220
|
rasterio.windows.get_data_window(
|
|
219
|
-
|
|
221
|
+
numpy.ma.masked_array(clip_mask_arr, ~clip_mask_arr)
|
|
220
222
|
)
|
|
221
223
|
)
|
|
222
|
-
if xds.rio.nodata is not None and not
|
|
224
|
+
if xds.rio.nodata is not None and not numpy.isnan(xds.rio.nodata):
|
|
223
225
|
cropped_ds = cropped_ds.fillna(xds.rio.nodata)
|
|
224
226
|
|
|
225
227
|
return cropped_ds.astype(xds.dtype)
|
|
@@ -383,6 +385,10 @@ class RasterArray(XRasterBase):
|
|
|
383
385
|
a 'crs' attribute to be set containing a valid CRS.
|
|
384
386
|
If using a WKT (e.g. from spatiareference.org), make sure it is an OGC WKT.
|
|
385
387
|
|
|
388
|
+
.. note:: To re-project with dask, see
|
|
389
|
+
`odc-geo <https://odc-geo.readthedocs.io/>`__ &
|
|
390
|
+
`pyresample <https://pyresample.readthedocs.io/>`__.
|
|
391
|
+
|
|
386
392
|
.. versionadded:: 0.0.27 shape
|
|
387
393
|
.. versionadded:: 0.0.28 transform
|
|
388
394
|
.. versionadded:: 0.5.0 nodata, kwargs
|
|
@@ -498,15 +504,15 @@ class RasterArray(XRasterBase):
|
|
|
498
504
|
dst_nodata = default_nodata if nodata is None else nodata
|
|
499
505
|
return dst_nodata
|
|
500
506
|
|
|
501
|
-
def _create_dst_data(self, dst_height: int, dst_width: int) ->
|
|
507
|
+
def _create_dst_data(self, dst_height: int, dst_width: int) -> numpy.ndarray:
|
|
502
508
|
extra_dim = self._check_dimensions()
|
|
503
509
|
if extra_dim:
|
|
504
|
-
dst_data =
|
|
510
|
+
dst_data = numpy.zeros(
|
|
505
511
|
(self._obj[extra_dim].size, dst_height, dst_width),
|
|
506
512
|
dtype=self._obj.dtype.type,
|
|
507
513
|
)
|
|
508
514
|
else:
|
|
509
|
-
dst_data =
|
|
515
|
+
dst_data = numpy.zeros((dst_height, dst_width), dtype=self._obj.dtype.type)
|
|
510
516
|
return dst_data
|
|
511
517
|
|
|
512
518
|
def reproject_match(
|
|
@@ -597,7 +603,7 @@ class RasterArray(XRasterBase):
|
|
|
597
603
|
Maximum bound for y coordinate.
|
|
598
604
|
constant_values: scalar, tuple or mapping of hashable to tuple
|
|
599
605
|
The value used for padding. If None, nodata will be used if it is
|
|
600
|
-
set, and
|
|
606
|
+
set, and numpy.nan otherwise.
|
|
601
607
|
|
|
602
608
|
|
|
603
609
|
Returns
|
|
@@ -610,33 +616,33 @@ class RasterArray(XRasterBase):
|
|
|
610
616
|
resolution_x, resolution_y = self.resolution()
|
|
611
617
|
y_before = y_after = 0
|
|
612
618
|
x_before = x_after = 0
|
|
613
|
-
y_coord: Union[xarray.DataArray,
|
|
614
|
-
x_coord: Union[xarray.DataArray,
|
|
619
|
+
y_coord: Union[xarray.DataArray, numpy.ndarray] = self._obj[self.y_dim]
|
|
620
|
+
x_coord: Union[xarray.DataArray, numpy.ndarray] = self._obj[self.x_dim]
|
|
615
621
|
|
|
616
622
|
if top - resolution_y < maxy:
|
|
617
|
-
new_y_coord:
|
|
623
|
+
new_y_coord: numpy.ndarray = numpy.arange(bottom, maxy, -resolution_y)[::-1]
|
|
618
624
|
y_before = len(new_y_coord) - len(y_coord)
|
|
619
625
|
y_coord = new_y_coord
|
|
620
626
|
top = y_coord[0]
|
|
621
627
|
if bottom + resolution_y > miny:
|
|
622
|
-
new_y_coord =
|
|
628
|
+
new_y_coord = numpy.arange(top, miny, resolution_y)
|
|
623
629
|
y_after = len(new_y_coord) - len(y_coord)
|
|
624
630
|
y_coord = new_y_coord
|
|
625
631
|
bottom = y_coord[-1]
|
|
626
632
|
|
|
627
633
|
if left - resolution_x > minx:
|
|
628
|
-
new_x_coord:
|
|
634
|
+
new_x_coord: numpy.ndarray = numpy.arange(right, minx, -resolution_x)[::-1]
|
|
629
635
|
x_before = len(new_x_coord) - len(x_coord)
|
|
630
636
|
x_coord = new_x_coord
|
|
631
637
|
left = x_coord[0]
|
|
632
638
|
if right + resolution_x < maxx:
|
|
633
|
-
new_x_coord =
|
|
639
|
+
new_x_coord = numpy.arange(left, maxx, resolution_x)
|
|
634
640
|
x_after = len(new_x_coord) - len(x_coord)
|
|
635
641
|
x_coord = new_x_coord
|
|
636
642
|
right = x_coord[-1]
|
|
637
643
|
|
|
638
644
|
if constant_values is None:
|
|
639
|
-
constant_values =
|
|
645
|
+
constant_values = numpy.nan if self.nodata is None else self.nodata
|
|
640
646
|
|
|
641
647
|
superset = self._obj.pad(
|
|
642
648
|
pad_width={
|
|
@@ -676,7 +682,7 @@ class RasterArray(XRasterBase):
|
|
|
676
682
|
Maximum bound for y coordinate.
|
|
677
683
|
constant_values: scalar, tuple or mapping of hashable to tuple
|
|
678
684
|
The value used for padding. If None, nodata will be used if it is
|
|
679
|
-
set, and
|
|
685
|
+
set, and numpy.nan otherwise.
|
|
680
686
|
|
|
681
687
|
|
|
682
688
|
Returns
|
|
@@ -786,10 +792,10 @@ class RasterArray(XRasterBase):
|
|
|
786
792
|
window_error = None
|
|
787
793
|
try:
|
|
788
794
|
window = rasterio.windows.from_bounds(
|
|
789
|
-
left=
|
|
790
|
-
bottom=
|
|
791
|
-
right=
|
|
792
|
-
top=
|
|
795
|
+
left=numpy.array(left).item(),
|
|
796
|
+
bottom=numpy.array(bottom).item(),
|
|
797
|
+
right=numpy.array(right).item(),
|
|
798
|
+
top=numpy.array(top).item(),
|
|
793
799
|
transform=self.transform(recalc=True),
|
|
794
800
|
)
|
|
795
801
|
cl_array: xarray.DataArray = self.isel_window(window) # type: ignore
|
|
@@ -925,7 +931,7 @@ class RasterArray(XRasterBase):
|
|
|
925
931
|
|
|
926
932
|
def _interpolate_na(
|
|
927
933
|
self, src_data: Any, method: Literal["linear", "nearest", "cubic"] = "nearest"
|
|
928
|
-
) ->
|
|
934
|
+
) -> numpy.ndarray:
|
|
929
935
|
"""
|
|
930
936
|
This method uses scipy.interpolate.griddata to interpolate missing data.
|
|
931
937
|
|
|
@@ -952,18 +958,18 @@ class RasterArray(XRasterBase):
|
|
|
952
958
|
|
|
953
959
|
src_data_flat = src_data.flatten()
|
|
954
960
|
try:
|
|
955
|
-
data_isnan =
|
|
961
|
+
data_isnan = numpy.isnan(self.nodata) # type: ignore
|
|
956
962
|
except TypeError:
|
|
957
963
|
data_isnan = False
|
|
958
964
|
if not data_isnan:
|
|
959
965
|
data_bool = src_data_flat != self.nodata
|
|
960
966
|
else:
|
|
961
|
-
data_bool = ~
|
|
967
|
+
data_bool = ~numpy.isnan(src_data_flat)
|
|
962
968
|
|
|
963
969
|
if not data_bool.any():
|
|
964
970
|
return src_data
|
|
965
971
|
|
|
966
|
-
x_coords, y_coords =
|
|
972
|
+
x_coords, y_coords = numpy.meshgrid(
|
|
967
973
|
self._obj.coords[self.x_dim].values, self._obj.coords[self.y_dim].values
|
|
968
974
|
)
|
|
969
975
|
|
|
@@ -1006,7 +1012,7 @@ class RasterArray(XRasterBase):
|
|
|
1006
1012
|
interp_data.append(
|
|
1007
1013
|
self._interpolate_na(sub_xds.load().data, method=method)
|
|
1008
1014
|
)
|
|
1009
|
-
interp_data =
|
|
1015
|
+
interp_data = numpy.array(interp_data) # type: ignore
|
|
1010
1016
|
else:
|
|
1011
1017
|
interp_data = self._interpolate_na(self._obj.load().data, method=method) # type: ignore
|
|
1012
1018
|
|
|
@@ -1028,7 +1034,7 @@ class RasterArray(XRasterBase):
|
|
|
1028
1034
|
self,
|
|
1029
1035
|
raster_path: Union[str, os.PathLike],
|
|
1030
1036
|
driver: Optional[str] = None,
|
|
1031
|
-
dtype: Optional[Union[str,
|
|
1037
|
+
dtype: Optional[Union[str, numpy.dtype]] = None,
|
|
1032
1038
|
tags: Optional[dict[str, str]] = None,
|
|
1033
1039
|
windowed: bool = False,
|
|
1034
1040
|
recalc_transform: bool = True,
|
|
@@ -7,7 +7,7 @@ from collections.abc import Iterable, Mapping
|
|
|
7
7
|
from typing import Any, Literal, Optional, Union
|
|
8
8
|
from uuid import uuid4
|
|
9
9
|
|
|
10
|
-
import numpy
|
|
10
|
+
import numpy
|
|
11
11
|
import rasterio.crs
|
|
12
12
|
import xarray
|
|
13
13
|
from affine import Affine
|
|
@@ -74,6 +74,10 @@ class RasterDataset(XRasterBase):
|
|
|
74
74
|
a 'crs' attribute to be set containing a valid CRS.
|
|
75
75
|
If using a WKT (e.g. from spatiareference.org), make sure it is an OGC WKT.
|
|
76
76
|
|
|
77
|
+
.. note:: To re-project with dask, see
|
|
78
|
+
`odc-geo <https://odc-geo.readthedocs.io/>`__ &
|
|
79
|
+
`pyresample <https://pyresample.readthedocs.io/>`__.
|
|
80
|
+
|
|
77
81
|
.. versionadded:: 0.0.27 shape
|
|
78
82
|
.. versionadded:: 0.0.28 transform
|
|
79
83
|
.. versionadded:: 0.5.0 nodata, kwargs
|
|
@@ -217,7 +221,7 @@ class RasterDataset(XRasterBase):
|
|
|
217
221
|
Maximum bound for y coordinate.
|
|
218
222
|
constant_values: scalar, tuple or mapping of hashable to tuple
|
|
219
223
|
The value used for padding. If None, nodata will be used if it is
|
|
220
|
-
set, and
|
|
224
|
+
set, and numpy.nan otherwise.
|
|
221
225
|
|
|
222
226
|
Returns
|
|
223
227
|
-------
|
|
@@ -442,7 +446,7 @@ class RasterDataset(XRasterBase):
|
|
|
442
446
|
self,
|
|
443
447
|
raster_path: Union[str, os.PathLike],
|
|
444
448
|
driver: Optional[str] = None,
|
|
445
|
-
dtype: Optional[Union[str,
|
|
449
|
+
dtype: Optional[Union[str, numpy.dtype]] = None,
|
|
446
450
|
tags: Optional[dict[str, str]] = None,
|
|
447
451
|
windowed: bool = False,
|
|
448
452
|
recalc_transform: bool = True,
|
|
@@ -518,7 +522,7 @@ class RasterDataset(XRasterBase):
|
|
|
518
522
|
nodata = nodatavals[0]
|
|
519
523
|
if (
|
|
520
524
|
all(nodataval == nodata for nodataval in nodatavals)
|
|
521
|
-
or
|
|
525
|
+
or numpy.isnan(nodatavals).all()
|
|
522
526
|
):
|
|
523
527
|
data_array.rio.write_nodata(nodata, inplace=True)
|
|
524
528
|
else:
|
|
@@ -237,10 +237,10 @@ class RasterioWriter:
|
|
|
237
237
|
Call ".compute()" on the Delayed object to compute the result
|
|
238
238
|
later. Call ``dask.compute(delayed1, delayed2)`` to save
|
|
239
239
|
multiple delayed files at once.
|
|
240
|
-
dtype:
|
|
240
|
+
dtype: numpy.dtype
|
|
241
241
|
Numpy-compliant dtype used to save raster. If data is not already
|
|
242
242
|
represented by this dtype in memory it is recast. dtype='complex_int16'
|
|
243
|
-
is a special case to write in-memory
|
|
243
|
+
is a special case to write in-memory numpy.complex64 to CInt16.
|
|
244
244
|
**kwargs
|
|
245
245
|
Keyword arguments to pass into writing the raster.
|
|
246
246
|
"""
|
|
@@ -8,12 +8,14 @@ import warnings
|
|
|
8
8
|
from collections.abc import Hashable, Iterable
|
|
9
9
|
from typing import Any, Literal, Optional, Union
|
|
10
10
|
|
|
11
|
-
import numpy
|
|
11
|
+
import numpy
|
|
12
12
|
import pyproj
|
|
13
13
|
import rasterio.warp
|
|
14
14
|
import rasterio.windows
|
|
15
15
|
import xarray
|
|
16
16
|
from affine import Affine
|
|
17
|
+
from pyproj.aoi import AreaOfInterest
|
|
18
|
+
from pyproj.database import query_utm_crs_info
|
|
17
19
|
from rasterio.control import GroundControlPoint
|
|
18
20
|
from rasterio.crs import CRS
|
|
19
21
|
|
|
@@ -80,7 +82,7 @@ def _resolution(affine: Affine) -> tuple[float, float]:
|
|
|
80
82
|
|
|
81
83
|
def affine_to_coords(
|
|
82
84
|
affine: Affine, width: int, height: int, x_dim: str = "x", y_dim: str = "y"
|
|
83
|
-
) -> dict[str,
|
|
85
|
+
) -> dict[str, numpy.ndarray]:
|
|
84
86
|
"""Generate 1d pixel centered coordinates from affine.
|
|
85
87
|
|
|
86
88
|
Based on code from the xarray rasterio backend.
|
|
@@ -105,12 +107,12 @@ def affine_to_coords(
|
|
|
105
107
|
"""
|
|
106
108
|
transform = affine * affine.translation(0.5, 0.5)
|
|
107
109
|
if affine.is_rectilinear and not _affine_has_rotation(affine):
|
|
108
|
-
x_coords, _ = transform * (
|
|
109
|
-
_, y_coords = transform * (
|
|
110
|
+
x_coords, _ = transform * (numpy.arange(width), numpy.zeros(width))
|
|
111
|
+
_, y_coords = transform * (numpy.zeros(height), numpy.arange(height))
|
|
110
112
|
else:
|
|
111
|
-
x_coords, y_coords = transform *
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
x_coords, y_coords = transform * numpy.meshgrid(
|
|
114
|
+
numpy.arange(width),
|
|
115
|
+
numpy.arange(height),
|
|
114
116
|
)
|
|
115
117
|
return {y_dim: y_coords, x_dim: x_coords}
|
|
116
118
|
|
|
@@ -195,7 +197,7 @@ def _get_spatial_dims(
|
|
|
195
197
|
except MissingSpatialDimensionError as err:
|
|
196
198
|
try:
|
|
197
199
|
obj[var].rio.set_spatial_dims(
|
|
198
|
-
x_dim=obj.rio.x_dim, y_dim=obj.rio.
|
|
200
|
+
x_dim=obj.rio.x_dim, y_dim=obj.rio.y_dim, inplace=True
|
|
199
201
|
)
|
|
200
202
|
return obj.rio.x_dim, obj.rio.y_dim
|
|
201
203
|
except MissingSpatialDimensionError:
|
|
@@ -531,13 +533,6 @@ class XRasterBase:
|
|
|
531
533
|
-------
|
|
532
534
|
rasterio.crs.CRS
|
|
533
535
|
"""
|
|
534
|
-
# pylint: disable=import-outside-toplevel
|
|
535
|
-
try:
|
|
536
|
-
from pyproj.aoi import AreaOfInterest
|
|
537
|
-
from pyproj.database import query_utm_crs_info
|
|
538
|
-
except ImportError:
|
|
539
|
-
raise RuntimeError("pyproj 3+ required for estimate_utm_crs.") from None
|
|
540
|
-
|
|
541
536
|
if self.crs is None:
|
|
542
537
|
raise RuntimeError("crs must be set to estimate UTM CRS.")
|
|
543
538
|
|
|
@@ -547,8 +542,8 @@ class XRasterBase:
|
|
|
547
542
|
else:
|
|
548
543
|
minx, miny, maxx, maxy = self.transform_bounds("EPSG:4326", recalc=True)
|
|
549
544
|
|
|
550
|
-
x_center =
|
|
551
|
-
y_center =
|
|
545
|
+
x_center = numpy.mean([minx, maxx]).item()
|
|
546
|
+
y_center = numpy.mean([miny, maxy]).item()
|
|
552
547
|
|
|
553
548
|
utm_crs_list = query_utm_crs_info(
|
|
554
549
|
datum_name=datum_name,
|
|
@@ -572,7 +567,7 @@ class XRasterBase:
|
|
|
572
567
|
"""
|
|
573
568
|
try:
|
|
574
569
|
# look in grid_mapping
|
|
575
|
-
transform =
|
|
570
|
+
transform = numpy.fromstring(
|
|
576
571
|
self._obj.coords[self.grid_mapping].attrs["GeoTransform"], sep=" "
|
|
577
572
|
)
|
|
578
573
|
# Calling .tolist() to assure the arguments are Python float and JSON serializable
|
|
@@ -1253,18 +1248,20 @@ class XRasterBase:
|
|
|
1253
1248
|
except (KeyError, AttributeError):
|
|
1254
1249
|
return None
|
|
1255
1250
|
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1251
|
+
def _parse_gcp(gcp) -> GroundControlPoint:
|
|
1252
|
+
x, y, *z = gcp["geometry"]["coordinates"]
|
|
1253
|
+
z = z[0] if z else None
|
|
1254
|
+
return GroundControlPoint(
|
|
1255
|
+
x=x,
|
|
1256
|
+
y=y,
|
|
1257
|
+
z=z,
|
|
1261
1258
|
row=gcp["properties"]["row"],
|
|
1262
1259
|
col=gcp["properties"]["col"],
|
|
1263
1260
|
id=gcp["properties"]["id"],
|
|
1264
1261
|
info=gcp["properties"]["info"],
|
|
1265
1262
|
)
|
|
1266
|
-
|
|
1267
|
-
]
|
|
1263
|
+
|
|
1264
|
+
gcps = [_parse_gcp(gcp) for gcp in geojson_gcps["features"]]
|
|
1268
1265
|
return gcps
|
|
1269
1266
|
|
|
1270
1267
|
|
|
@@ -1282,6 +1279,12 @@ def _convert_gcps_to_geojson(
|
|
|
1282
1279
|
-------
|
|
1283
1280
|
A FeatureCollection dict.
|
|
1284
1281
|
"""
|
|
1282
|
+
|
|
1283
|
+
def _gcp_coordinates(gcp):
|
|
1284
|
+
if gcp.z is None:
|
|
1285
|
+
return [gcp.x, gcp.y]
|
|
1286
|
+
return [gcp.x, gcp.y, gcp.z]
|
|
1287
|
+
|
|
1285
1288
|
features = [
|
|
1286
1289
|
{
|
|
1287
1290
|
"type": "Feature",
|
|
@@ -1291,7 +1294,7 @@ def _convert_gcps_to_geojson(
|
|
|
1291
1294
|
"row": gcp.row,
|
|
1292
1295
|
"col": gcp.col,
|
|
1293
1296
|
},
|
|
1294
|
-
"geometry": {"type": "Point", "coordinates":
|
|
1297
|
+
"geometry": {"type": "Point", "coordinates": _gcp_coordinates(gcp)},
|
|
1295
1298
|
}
|
|
1296
1299
|
for gcp in gcps
|
|
1297
1300
|
]
|
|
@@ -5,7 +5,7 @@ through a backend entrypoint.
|
|
|
5
5
|
# pylint: disable=arguments-differ
|
|
6
6
|
import os.path
|
|
7
7
|
|
|
8
|
-
import xarray
|
|
8
|
+
import xarray
|
|
9
9
|
|
|
10
10
|
from . import _io
|
|
11
11
|
from .exceptions import RioXarrayError
|
|
@@ -26,7 +26,7 @@ CAN_OPEN_EXTS = {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
class RasterioBackend(
|
|
29
|
+
class RasterioBackend(xarray.backends.common.BackendEntrypoint):
|
|
30
30
|
"""
|
|
31
31
|
Requires xarray 0.18+
|
|
32
32
|
|
|
@@ -38,8 +38,6 @@ class RasterioBackend(xr.backends.common.BackendEntrypoint):
|
|
|
38
38
|
filename_or_obj,
|
|
39
39
|
drop_variables=None,
|
|
40
40
|
parse_coordinates=None,
|
|
41
|
-
chunks=None,
|
|
42
|
-
cache=None,
|
|
43
41
|
lock=None,
|
|
44
42
|
masked=False,
|
|
45
43
|
mask_and_scale=True,
|
|
@@ -56,8 +54,7 @@ class RasterioBackend(xr.backends.common.BackendEntrypoint):
|
|
|
56
54
|
rds = _io.open_rasterio(
|
|
57
55
|
filename_or_obj,
|
|
58
56
|
parse_coordinates=parse_coordinates,
|
|
59
|
-
|
|
60
|
-
cache=cache,
|
|
57
|
+
cache=False,
|
|
61
58
|
lock=lock,
|
|
62
59
|
masked=masked,
|
|
63
60
|
mask_and_scale=mask_and_scale,
|
|
@@ -69,7 +66,7 @@ class RasterioBackend(xr.backends.common.BackendEntrypoint):
|
|
|
69
66
|
band_as_variable=band_as_variable,
|
|
70
67
|
**open_kwargs,
|
|
71
68
|
)
|
|
72
|
-
if isinstance(rds,
|
|
69
|
+
if isinstance(rds, xarray.DataArray):
|
|
73
70
|
dataset = rds.to_dataset()
|
|
74
71
|
dataset.set_close(rds._close)
|
|
75
72
|
rds = dataset
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: rioxarray
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.15.1
|
|
4
4
|
Summary: geospatial xarray extension powered by rasterio
|
|
5
5
|
Home-page: https://github.com/corteva/rioxarray
|
|
6
6
|
Download-URL: http://python.org/pypi/rioxarray
|
|
@@ -15,20 +15,67 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
17
17
|
Classifier: Programming Language :: Python
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
21
|
Classifier: Programming Language :: Python :: 3
|
|
22
22
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
23
|
Classifier: Typing :: Typed
|
|
24
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
25
|
Description-Content-Type: text/x-rst
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: packaging
|
|
28
|
+
Requires-Dist: rasterio>=1.3
|
|
29
|
+
Requires-Dist: xarray>=2022.3.0
|
|
30
|
+
Requires-Dist: pyproj>=3.3
|
|
31
|
+
Requires-Dist: numpy>=1.23
|
|
26
32
|
Provides-Extra: interp
|
|
33
|
+
Requires-Dist: scipy; extra == "interp"
|
|
27
34
|
Provides-Extra: doc
|
|
35
|
+
Requires-Dist: sphinx-click; extra == "doc"
|
|
36
|
+
Requires-Dist: nbsphinx; extra == "doc"
|
|
37
|
+
Requires-Dist: sphinx_rtd_theme; extra == "doc"
|
|
28
38
|
Provides-Extra: test
|
|
39
|
+
Requires-Dist: pytest>=3.6; extra == "test"
|
|
40
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
41
|
+
Requires-Dist: pytest-timeout; extra == "test"
|
|
42
|
+
Requires-Dist: dask; extra == "test"
|
|
43
|
+
Requires-Dist: netcdf4; extra == "test"
|
|
29
44
|
Provides-Extra: dev
|
|
45
|
+
Requires-Dist: scipy; extra == "dev"
|
|
46
|
+
Requires-Dist: sphinx-click; extra == "dev"
|
|
47
|
+
Requires-Dist: nbsphinx; extra == "dev"
|
|
48
|
+
Requires-Dist: sphinx_rtd_theme; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest>=3.6; extra == "dev"
|
|
50
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
51
|
+
Requires-Dist: pytest-timeout; extra == "dev"
|
|
52
|
+
Requires-Dist: dask; extra == "dev"
|
|
53
|
+
Requires-Dist: netcdf4; extra == "dev"
|
|
54
|
+
Requires-Dist: pylint; extra == "dev"
|
|
55
|
+
Requires-Dist: mypy; extra == "dev"
|
|
56
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
30
57
|
Provides-Extra: all
|
|
31
|
-
|
|
58
|
+
Requires-Dist: scipy; extra == "all"
|
|
59
|
+
Requires-Dist: sphinx-click; extra == "all"
|
|
60
|
+
Requires-Dist: nbsphinx; extra == "all"
|
|
61
|
+
Requires-Dist: sphinx_rtd_theme; extra == "all"
|
|
62
|
+
Requires-Dist: pytest>=3.6; extra == "all"
|
|
63
|
+
Requires-Dist: pytest-cov; extra == "all"
|
|
64
|
+
Requires-Dist: pytest-timeout; extra == "all"
|
|
65
|
+
Requires-Dist: dask; extra == "all"
|
|
66
|
+
Requires-Dist: netcdf4; extra == "all"
|
|
67
|
+
Requires-Dist: scipy; extra == "all"
|
|
68
|
+
Requires-Dist: sphinx-click; extra == "all"
|
|
69
|
+
Requires-Dist: nbsphinx; extra == "all"
|
|
70
|
+
Requires-Dist: sphinx_rtd_theme; extra == "all"
|
|
71
|
+
Requires-Dist: pytest>=3.6; extra == "all"
|
|
72
|
+
Requires-Dist: pytest-cov; extra == "all"
|
|
73
|
+
Requires-Dist: pytest-timeout; extra == "all"
|
|
74
|
+
Requires-Dist: dask; extra == "all"
|
|
75
|
+
Requires-Dist: netcdf4; extra == "all"
|
|
76
|
+
Requires-Dist: pylint; extra == "all"
|
|
77
|
+
Requires-Dist: mypy; extra == "all"
|
|
78
|
+
Requires-Dist: pre-commit; extra == "all"
|
|
32
79
|
|
|
33
80
|
================
|
|
34
81
|
rioxarray README
|
|
@@ -41,7 +88,7 @@ rasterio xarray extension.
|
|
|
41
88
|
:alt: Join the chat at https://gitter.im/rioxarray/community
|
|
42
89
|
:target: https://gitter.im/rioxarray/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
|
|
43
90
|
|
|
44
|
-
.. image:: https://img.shields.io/badge/all_contributors-
|
|
91
|
+
.. image:: https://img.shields.io/badge/all_contributors-35-orange.svg?style=flat-square
|
|
45
92
|
:alt: All Contributors
|
|
46
93
|
:target: https://github.com/corteva/rioxarray/blob/master/AUTHORS.rst
|
|
47
94
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
author = rioxarray Contributors
|
|
3
3
|
name = rioxarray
|
|
4
|
-
version = 0.
|
|
4
|
+
version = 0.15.1
|
|
5
5
|
description = geospatial xarray extension powered by rasterio
|
|
6
6
|
keywords = rioxarray, xarray, rasterio
|
|
7
7
|
long_description = file: README.rst
|
|
@@ -17,9 +17,9 @@ classifiers =
|
|
|
17
17
|
Operating System :: OS Independent
|
|
18
18
|
Topic :: Scientific/Engineering :: GIS
|
|
19
19
|
Programming Language :: Python
|
|
20
|
-
Programming Language :: Python :: 3.9
|
|
21
20
|
Programming Language :: Python :: 3.10
|
|
22
21
|
Programming Language :: Python :: 3.11
|
|
22
|
+
Programming Language :: Python :: 3.12
|
|
23
23
|
Programming Language :: Python :: 3
|
|
24
24
|
Topic :: Software Development :: Libraries :: Python Modules
|
|
25
25
|
Typing :: Typed
|
|
@@ -30,13 +30,13 @@ download_url = http://python.org/pypi/rioxarray
|
|
|
30
30
|
packages = find:
|
|
31
31
|
zip_safe = False # https://mypy.readthedocs.io/en/stable/installed_packages.html
|
|
32
32
|
include_package_data = True
|
|
33
|
-
python_requires = >=3.
|
|
33
|
+
python_requires = >=3.10
|
|
34
34
|
install_requires =
|
|
35
35
|
packaging
|
|
36
|
-
rasterio>=1.
|
|
37
|
-
xarray>=0
|
|
38
|
-
pyproj>=
|
|
39
|
-
numpy>=1.
|
|
36
|
+
rasterio>=1.3
|
|
37
|
+
xarray>=2022.3.0
|
|
38
|
+
pyproj>=3.3
|
|
39
|
+
numpy>=1.23
|
|
40
40
|
|
|
41
41
|
[options.package_data]
|
|
42
42
|
rioxarray =
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"""Top-level package for rioxarray."""
|
|
2
|
-
__author__ = """rioxarray Contributors"""
|
|
3
|
-
import importlib.metadata
|
|
4
|
-
|
|
5
|
-
import rioxarray.raster_array # noqa
|
|
6
|
-
import rioxarray.raster_dataset # noqa
|
|
7
|
-
from rioxarray._io import open_rasterio # noqa
|
|
8
|
-
from rioxarray._options import set_options # noqa
|
|
9
|
-
from rioxarray._show_versions import show_versions # noqa
|
|
10
|
-
|
|
11
|
-
__version__ = importlib.metadata.version(__package__)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|