rioxarray 0.24.0__tar.gz → 0.25.0__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.
Files changed (37) hide show
  1. {rioxarray-0.24.0 → rioxarray-0.25.0}/AUTHORS.rst +2 -0
  2. {rioxarray-0.24.0 → rioxarray-0.25.0}/PKG-INFO +2 -2
  3. {rioxarray-0.24.0 → rioxarray-0.25.0}/README.rst +1 -1
  4. {rioxarray-0.24.0 → rioxarray-0.25.0}/pyproject.toml +2 -2
  5. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/_convention/zarr.py +30 -2
  6. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/rioxarray.py +17 -3
  7. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray.egg-info/PKG-INFO +2 -2
  8. {rioxarray-0.24.0 → rioxarray-0.25.0}/CONTRIBUTING.rst +0 -0
  9. {rioxarray-0.24.0 → rioxarray-0.25.0}/LICENSE +0 -0
  10. {rioxarray-0.24.0 → rioxarray-0.25.0}/LICENSE_datacube +0 -0
  11. {rioxarray-0.24.0 → rioxarray-0.25.0}/LICENSE_xarray +0 -0
  12. {rioxarray-0.24.0 → rioxarray-0.25.0}/MANIFEST.in +0 -0
  13. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/__init__.py +0 -0
  14. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/_convention/__init__.py +0 -0
  15. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/_convention/_base.py +0 -0
  16. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/_convention/_core.py +0 -0
  17. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/_convention/cf.py +0 -0
  18. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/_io.py +0 -0
  19. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/_options.py +0 -0
  20. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/_show_versions.py +0 -0
  21. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/_spatial_utils.py +0 -0
  22. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/crs.py +0 -0
  23. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/enum.py +0 -0
  24. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/exceptions.py +0 -0
  25. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/merge.py +0 -0
  26. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/py.typed +0 -0
  27. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/raster_array.py +0 -0
  28. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/raster_dataset.py +0 -0
  29. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/raster_writer.py +0 -0
  30. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray/xarray_plugin.py +0 -0
  31. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray.egg-info/SOURCES.txt +0 -0
  32. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray.egg-info/dependency_links.txt +0 -0
  33. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray.egg-info/entry_points.txt +0 -0
  34. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray.egg-info/requires.txt +0 -0
  35. {rioxarray-0.24.0 → rioxarray-0.25.0}/rioxarray.egg-info/top_level.txt +0 -0
  36. {rioxarray-0.24.0 → rioxarray-0.25.0}/setup.cfg +0 -0
  37. {rioxarray-0.24.0 → rioxarray-0.25.0}/setup.py +0 -0
@@ -77,6 +77,8 @@ Thanks goes to these wonderful people (`emoji key <https://allcontributors.org/d
77
77
  </tr>
78
78
  <tr>
79
79
  <td align="center" valign="top" width="14.28%"><a href="https://github.com/raashish1601"><img src="https://avatars.githubusercontent.com/u/94279692?v=4&size=100" width="100px" height="100px" alt="Raashish Aggarwal"/><br /><sub><b>Raashish Aggarwal</b></sub></a><br /><a href="https://github.com/vylor/rioxarray/issues?q=author%3Araashish1601" title="Bug reports">🐛</a></td>
80
+ <td align="center" valign="top" width="14.28%"><a href="https://dylanpulver.com/"><img src="https://avatars.githubusercontent.com/u/35541198?v=4&size=100" width="100px" height="100px" alt="Dylan Pulver"/><br /><sub><b>Dylan Pulver</b></sub></a><br /><a href="https://github.com/vylor/rioxarray/commits?author=dylanpulver" title="Documentation">📖</a></td>
81
+ <td align="center" valign="top" width="14.28%"><a href="http://community.haskell.org/~pj"><img src="https://avatars.githubusercontent.com/u/2082449?v=4&size=100" width="100px" height="100px" alt="Peter A. Jonsson"/><br /><sub><b>Peter A. Jonsson</b></sub></a><br /><a href="https://github.com/vylor/rioxarray/commits?author=pjonsson" title="Documentation">📖</a></td>
80
82
  </tr>
81
83
  </tbody>
82
84
  </table>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rioxarray
3
- Version: 0.24.0
3
+ Version: 0.25.0
4
4
  Summary: geospatial xarray extension powered by rasterio
5
5
  Maintainer: rioxarray Contributors
6
6
  License-Expression: Apache-2.0
@@ -45,7 +45,7 @@ rioxarray README
45
45
  rasterio xarray extension.
46
46
 
47
47
 
48
- .. image:: https://img.shields.io/badge/all_contributors-50-orange.svg?style=flat-square
48
+ .. image:: https://img.shields.io/badge/all_contributors-52-orange.svg?style=flat-square
49
49
  :alt: All Contributors
50
50
  :target: https://github.com/vylor/rioxarray/blob/master/AUTHORS.rst
51
51
 
@@ -5,7 +5,7 @@ rioxarray README
5
5
  rasterio xarray extension.
6
6
 
7
7
 
8
- .. image:: https://img.shields.io/badge/all_contributors-50-orange.svg?style=flat-square
8
+ .. image:: https://img.shields.io/badge/all_contributors-52-orange.svg?style=flat-square
9
9
  :alt: All Contributors
10
10
  :target: https://github.com/vylor/rioxarray/blob/master/AUTHORS.rst
11
11
 
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
2
  # Minimum requirements for the build system to execute.
3
- requires = ["setuptools", "wheel"]
3
+ requires = ["setuptools"]
4
4
 
5
5
  [project]
6
6
  name = "rioxarray"
7
- version = "0.24.0"
7
+ version = "0.25.0"
8
8
  description = "geospatial xarray extension powered by rasterio"
9
9
  maintainers = [
10
10
  {name = "rioxarray Contributors"},
@@ -12,7 +12,9 @@ import rasterio.crs
12
12
  import rasterio.transform
13
13
  import xarray
14
14
  from affine import Affine
15
+ from rasterio.enums import WktVersion
15
16
 
17
+ from rioxarray._spatial_utils import _has_spatial_dims
16
18
  from rioxarray.crs import crs_from_user_input
17
19
 
18
20
  # Convention identifiers
@@ -305,6 +307,7 @@ class ZarrConvention:
305
307
  cls,
306
308
  obj: Union[xarray.Dataset, xarray.DataArray],
307
309
  crs: rasterio.crs.CRS,
310
+ propagate_to_variables: bool = False,
308
311
  **kwargs,
309
312
  ) -> Union[xarray.Dataset, xarray.DataArray]:
310
313
  """
@@ -316,6 +319,8 @@ class ZarrConvention:
316
319
  Object to write CRS to
317
320
  crs : rasterio.crs.CRS
318
321
  CRS to write
322
+ propagate_to_variables : bool, default False
323
+ If True, propagate the CRS to dataset data variables with spatial dimensions.
319
324
  **kwargs
320
325
  Additional convention-specific parameters (e.g., grid_mapping_name for CF;
321
326
  silently ignored here)
@@ -326,15 +331,26 @@ class ZarrConvention:
326
331
  Object with CRS written
327
332
  """
328
333
  add_convention_declaration(obj.attrs, "proj:")
329
- obj.attrs["proj:wkt2"] = crs.to_wkt()
334
+ obj.attrs["proj:wkt2"] = crs.to_wkt(version=WktVersion.WKT2_2019)
335
+ if not propagate_to_variables:
336
+ return obj
337
+ for data_var in getattr(obj, "data_vars", ()):
338
+ if not _has_spatial_dims(obj, var=data_var):
339
+ continue
340
+ cls.write_crs(
341
+ obj[data_var],
342
+ crs=crs,
343
+ **kwargs,
344
+ )
330
345
  return obj
331
346
 
332
347
  @classmethod
333
- def write_transform( # pylint: disable=unused-argument
348
+ def write_transform(
334
349
  cls,
335
350
  obj: Union[xarray.Dataset, xarray.DataArray],
336
351
  *,
337
352
  transform: Affine,
353
+ propagate_to_variables: bool = False,
338
354
  **kwargs,
339
355
  ) -> Union[xarray.Dataset, xarray.DataArray]:
340
356
  """
@@ -346,6 +362,8 @@ class ZarrConvention:
346
362
  Object to write transform to
347
363
  transform : affine.Affine
348
364
  Transform to write
365
+ propagate_to_variables : bool, default False
366
+ If True, propagate the transform to dataset data variables with spatial dimensions.
349
367
  **kwargs
350
368
  Additional convention-specific parameters (e.g., grid_mapping_name for CF;
351
369
  silently ignored here)
@@ -368,4 +386,14 @@ class ZarrConvention:
368
386
  )
369
387
  obj.attrs["spatial:bbox"] = [left, bottom, right, top]
370
388
  obj.attrs["spatial:registration"] = "pixel"
389
+ if not propagate_to_variables:
390
+ return obj
391
+ for data_var in getattr(obj, "data_vars", ()):
392
+ if not _has_spatial_dims(obj, var=data_var):
393
+ continue
394
+ cls.write_transform(
395
+ obj[data_var],
396
+ transform=transform,
397
+ **kwargs,
398
+ )
371
399
  return obj
@@ -257,12 +257,15 @@ class XRasterBase:
257
257
  self,
258
258
  input_crs: Optional[Any] = None,
259
259
  grid_mapping_name: Optional[str] = None,
260
+ propagate_to_variables: bool = False,
260
261
  convention: Optional[Convention] = None,
261
262
  inplace: bool = False,
262
263
  ) -> Union[xarray.Dataset, xarray.DataArray]:
263
264
  """
264
265
  Write the CRS to the dataset using the specified convention.
265
266
 
267
+ .. versionadded:: 0.25.0 propagate_to_variables
268
+
266
269
  .. warning:: When using CF convention, the grid_mapping attribute is written to the encoding.
267
270
 
268
271
  Parameters
@@ -272,6 +275,9 @@ class XRasterBase:
272
275
  grid_mapping_name: str, optional
273
276
  Name of the grid_mapping coordinate to store the CRS information in.
274
277
  Only used with CF convention. Default is the grid_mapping name of the dataset.
278
+ propagate_to_variables : bool, default False
279
+ If True, propagate the CRS to dataset data variables with spatial dimensions
280
+ when using the Zarr convention.
275
281
  convention: Convention, optional
276
282
  Convention to use for writing CRS. If None, uses the global default
277
283
  from set_options(). Currently only CF convention is supported.
@@ -313,6 +319,7 @@ class XRasterBase:
313
319
  data_obj,
314
320
  crs=data_obj.rio.crs,
315
321
  grid_mapping_name=grid_mapping_name,
322
+ propagate_to_variables=propagate_to_variables,
316
323
  )
317
324
 
318
325
  def estimate_utm_crs(self, datum_name: str = "WGS 84") -> rasterio.crs.CRS:
@@ -367,11 +374,13 @@ class XRasterBase:
367
374
  self,
368
375
  transform: Optional[Affine] = None,
369
376
  grid_mapping_name: Optional[str] = None,
377
+ propagate_to_variables: bool = False,
370
378
  convention: Optional[Convention] = None,
371
379
  inplace: bool = False,
372
380
  ) -> Union[xarray.Dataset, xarray.DataArray]:
373
381
  """
374
382
  .. versionadded:: 0.0.30
383
+ .. versionadded:: 0.25.0 propagate_to_variables
375
384
 
376
385
  Write the transform to the dataset using the specified convention.
377
386
 
@@ -387,7 +396,10 @@ class XRasterBase:
387
396
  Only used with CF convention. Default is the grid_mapping name of the dataset.
388
397
  convention: Convention, optional
389
398
  Convention to use for writing transform. If None, uses the global default
390
- from set_options(). Currently only CF convention is supported.
399
+ from set_options().
400
+ propagate_to_variables : bool, default False
401
+ If True, propagate the transform to dataset data variables with spatial dimensions
402
+ when using the Zarr convention.
391
403
  inplace: bool, optional
392
404
  If True, it will write to the existing dataset. Default is False.
393
405
 
@@ -409,6 +421,7 @@ class XRasterBase:
409
421
  data_obj,
410
422
  transform=transform,
411
423
  grid_mapping_name=grid_mapping_name,
424
+ propagate_to_variables=propagate_to_variables,
412
425
  )
413
426
 
414
427
  def transform(self, recalc: bool = False) -> Affine:
@@ -905,6 +918,7 @@ class XRasterBase:
905
918
  ),
906
919
  self.transform(recalc=True),
907
920
  ),
921
+ propagate_to_variables=True,
908
922
  inplace=True,
909
923
  )
910
924
  )
@@ -955,7 +969,7 @@ class XRasterBase:
955
969
  self._obj.sel({self.x_dim: x_slice, self.y_dim: y_slice})
956
970
  .copy() # this is to prevent sharing coordinates with the original dataset
957
971
  .rio.set_spatial_dims(x_dim=self.x_dim, y_dim=self.y_dim, inplace=True)
958
- .rio.write_transform(inplace=True)
972
+ .rio.write_transform(inplace=True, propagate_to_variables=True)
959
973
  )
960
974
  return subset
961
975
 
@@ -1005,7 +1019,7 @@ class XRasterBase:
1005
1019
 
1006
1020
  Parameters
1007
1021
  ----------
1008
- gcp: list of :obj:`rasterio.control.GroundControlPoint`
1022
+ gcps: list of :obj:`rasterio.control.GroundControlPoint`
1009
1023
  The Ground Control Points to integrate to the dataset.
1010
1024
  gcp_crs: str, :obj:`rasterio.crs.CRS`, or dict
1011
1025
  Coordinate reference system for the GCPs.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rioxarray
3
- Version: 0.24.0
3
+ Version: 0.25.0
4
4
  Summary: geospatial xarray extension powered by rasterio
5
5
  Maintainer: rioxarray Contributors
6
6
  License-Expression: Apache-2.0
@@ -45,7 +45,7 @@ rioxarray README
45
45
  rasterio xarray extension.
46
46
 
47
47
 
48
- .. image:: https://img.shields.io/badge/all_contributors-50-orange.svg?style=flat-square
48
+ .. image:: https://img.shields.io/badge/all_contributors-52-orange.svg?style=flat-square
49
49
  :alt: All Contributors
50
50
  :target: https://github.com/vylor/rioxarray/blob/master/AUTHORS.rst
51
51
 
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