@@ -99,8 +99,8 @@ def __init__(
99
99
warnings .filterwarnings ("ignore" , message = "Parse metadata from file not implemented" )
100
100
super ().__init__ (filename_or_dataset , silent = silent , ** kwargs )
101
101
102
- # Ensure DEM has only one band: self.indexes can be None when data is not loaded through the Raster class
103
- if self .indexes is not None and len (self .indexes ) > 1 :
102
+ # Ensure DEM has only one band: self.bands can be None when data is not loaded through the Raster class
103
+ if self .bands is not None and len (self .bands ) > 1 :
104
104
raise ValueError ("DEM rasters should be composed of one band only" )
105
105
106
106
# If the CRS in the raster metadata has a 3rd dimension, could set it as a vertical reference
@@ -233,39 +233,39 @@ def ccrs(self) -> CompoundCRS | CRS | None:
233
233
234
234
def to_vcrs (
235
235
self ,
236
- dst_vcrs : Literal ["Ellipsoid" , "EGM08" , "EGM96" ] | str | pathlib .Path | VerticalCRS | int ,
237
- src_vcrs : Literal ["Ellipsoid" , "EGM08" , "EGM96" ] | str | pathlib .Path | VerticalCRS | int | None = None ,
236
+ vcrs : Literal ["Ellipsoid" , "EGM08" , "EGM96" ] | str | pathlib .Path | VerticalCRS | int ,
237
+ force_source_vcrs : Literal ["Ellipsoid" , "EGM08" , "EGM96" ] | str | pathlib .Path | VerticalCRS | int | None = None ,
238
238
) -> None :
239
239
"""
240
240
Convert the DEM to another vertical coordinate reference system.
241
241
242
- :param dst_vcrs : Destination vertical CRS. Either as a name ("WGS84", "EGM08", "EGM96"),
242
+ :param vcrs : Destination vertical CRS. Either as a name ("WGS84", "EGM08", "EGM96"),
243
243
an EPSG code or pyproj.crs.VerticalCRS, or a path to a PROJ grid file (https://github.com/OSGeo/PROJ-data)
244
- :param src_vcrs : Force a source vertical CRS (uses metadata by default). Same formats as for `dst_vcrs`.
244
+ :param force_source_vcrs : Force a source vertical CRS (uses metadata by default). Same formats as for `dst_vcrs`.
245
245
246
246
:return:
247
247
"""
248
248
249
- if self .vcrs is None and src_vcrs is None :
249
+ if self .vcrs is None and force_source_vcrs is None :
250
250
raise ValueError (
251
251
"The current DEM has no vertical reference, define one with .set_vref() "
252
252
"or by passing `src_vcrs` to perform a conversion."
253
253
)
254
254
255
255
# Initial Compound CRS (only exists if vertical CRS is not None, as checked above)
256
- if src_vcrs is not None :
256
+ if force_source_vcrs is not None :
257
257
# Warn if a vertical CRS already existed for that DEM
258
258
if self .vcrs is not None :
259
259
warnings .warn (
260
260
category = UserWarning ,
261
261
message = "Overriding the vertical CRS of the DEM with the one provided in `src_vcrs`." ,
262
262
)
263
- src_ccrs = _build_ccrs_from_crs_and_vcrs (self .crs , vcrs = src_vcrs )
263
+ src_ccrs = _build_ccrs_from_crs_and_vcrs (self .crs , vcrs = force_source_vcrs )
264
264
else :
265
265
src_ccrs = self .ccrs
266
266
267
267
# New destination Compound CRS
268
- dst_ccrs = _build_ccrs_from_crs_and_vcrs (self .crs , vcrs = _vcrs_from_user_input (vcrs_input = dst_vcrs ))
268
+ dst_ccrs = _build_ccrs_from_crs_and_vcrs (self .crs , vcrs = _vcrs_from_user_input (vcrs_input = vcrs ))
269
269
270
270
# If both compound CCRS are equal, do not run any transform
271
271
if src_ccrs .equals (dst_ccrs ):
@@ -284,4 +284,4 @@ def to_vcrs(
284
284
self ._data = zz_trans .astype (self .dtypes [0 ]) # type: ignore
285
285
286
286
# Update vcrs (which will update ccrs if called)
287
- self .set_vcrs (new_vcrs = dst_vcrs )
287
+ self .set_vcrs (new_vcrs = vcrs )
0 commit comments