@@ -295,6 +295,7 @@ class RasterioArrayWrapper(BackendArray):
295295
296296 def __init__ (
297297 self ,
298+ * ,
298299 manager ,
299300 lock ,
300301 name ,
@@ -512,7 +513,7 @@ def _to_numeric(value: Any) -> float:
512513 return value
513514
514515
515- def _parse_tag (key : str , value : Any ) -> tuple [str , Any ]:
516+ def _parse_tag (* , key : str , value : Any ) -> tuple [str , Any ]:
516517 # NC_GLOBAL is appended to tags with netcdf driver and is not really needed
517518 key = key .split ("NC_GLOBAL#" )[- 1 ]
518519 if value .startswith ("{" ) and value .endswith ("}" ):
@@ -530,7 +531,7 @@ def _parse_tag(key: str, value: Any) -> tuple[str, Any]:
530531def _parse_tags (tags : dict ) -> dict :
531532 parsed_tags = {}
532533 for key , value in tags .items ():
533- key , value = _parse_tag (key , value )
534+ key , value = _parse_tag (key = key , value = value )
534535 parsed_tags [key ] = value
535536 return parsed_tags
536537
@@ -552,15 +553,15 @@ def _parse_tags(tags: dict) -> dict:
552553}
553554
554555
555- def _load_netcdf_attrs (tags : dict , data_array : DataArray ) -> None :
556+ def _load_netcdf_attrs (* , tags : dict , data_array : DataArray ) -> None :
556557 """
557558 Loads the netCDF attributes into the data array
558559
559560 Attributes stored in this format:
560561 - variable_name#attr_name: attr_value
561562 """
562563 for key , value in tags .items ():
563- key , value = _parse_tag (key , value )
564+ key , value = _parse_tag (key = key , value = value )
564565 key_split = key .split ("#" )
565566 if len (key_split ) != 2 :
566567 continue
@@ -569,7 +570,7 @@ def _load_netcdf_attrs(tags: dict, data_array: DataArray) -> None:
569570 data_array .coords [variable_name ].attrs .update ({attr_name : value })
570571
571572
572- def _parse_netcdf_attr_array (attr : Union [NDArray , str ], dtype = None ) -> NDArray :
573+ def _parse_netcdf_attr_array (attr : Union [NDArray , str ], * , dtype = None ) -> NDArray :
573574 """
574575 Expected format: '{2,6}' or '[2. 6.]'
575576 """
@@ -775,7 +776,7 @@ def _pop_global_netcdf_attrs_from_vars(dataset_to_clean: Dataset) -> Dataset:
775776
776777
777778def _subdataset_groups_to_dataset (
778- dim_groups : dict [Hashable , dict [Hashable , DataArray ]], global_tags : dict
779+ * , dim_groups : dict [Hashable , dict [Hashable , DataArray ]], global_tags : dict
779780) -> Union [Dataset , list [Dataset ]]:
780781 if dim_groups :
781782 dataset : Union [Dataset , list [Dataset ]] = []
@@ -800,6 +801,7 @@ def _ds_close():
800801
801802def _load_subdatasets (
802803 riods : RasterioReader ,
804+ * ,
803805 group : Optional [Union [str , list [str ], tuple [str , ...]]],
804806 variable : Optional [Union [str , list [str ], tuple [str , ...]]],
805807 parse_coordinates : bool ,
@@ -845,6 +847,7 @@ def _load_subdatasets(
845847
846848def _load_bands_as_variables (
847849 riods : RasterioReader ,
850+ * ,
848851 parse_coordinates : bool ,
849852 chunks : Optional [Union [int , tuple , dict ]],
850853 cache : Optional [bool ],
@@ -896,6 +899,7 @@ def _ds_close():
896899
897900
898901def _prepare_dask (
902+ * ,
899903 result : DataArray ,
900904 riods : RasterioReader ,
901905 filename : Union [str , os .PathLike ],
@@ -936,6 +940,7 @@ def _prepare_dask(
936940
937941
938942def _handle_encoding (
943+ * ,
939944 result : DataArray ,
940945 mask_and_scale : bool ,
941946 masked : bool ,
@@ -991,6 +996,7 @@ def open_rasterio(
991996 rasterio .vrt .WarpedVRT ,
992997 SingleBandDatasetReader ,
993998 ],
999+ * ,
9941000 parse_coordinates : Optional [bool ] = None ,
9951001 chunks : Optional [Union [int , tuple , dict ]] = None ,
9961002 cache : Optional [bool ] = None ,
@@ -1206,7 +1212,9 @@ def open_rasterio(
12061212 # Get geospatial coordinates
12071213 if parse_coordinates :
12081214 coords .update (
1209- _generate_spatial_coords (riods .transform , riods .width , riods .height )
1215+ _generate_spatial_coords (
1216+ affine = riods .transform , width = riods .width , height = riods .height
1217+ )
12101218 )
12111219
12121220 unsigned = None
@@ -1220,8 +1228,8 @@ def open_rasterio(
12201228 da_name = attrs .pop ("NETCDF_VARNAME" , default_name )
12211229 data : Any = indexing .LazilyOuterIndexedArray (
12221230 RasterioArrayWrapper (
1223- manager ,
1224- lock ,
1231+ manager = manager ,
1232+ lock = lock ,
12251233 name = da_name ,
12261234 vrt_params = vrt_params ,
12271235 masked = masked ,
@@ -1241,7 +1249,7 @@ def open_rasterio(
12411249 result .encoding = encoding
12421250
12431251 # update attributes from NetCDF attributes
1244- _load_netcdf_attrs (riods .tags (), result )
1252+ _load_netcdf_attrs (tags = riods .tags (), data_array = result )
12451253 result = _decode_datetime_cf (
12461254 result , decode_times = decode_times , decode_timedelta = decode_timedelta
12471255 )
@@ -1251,7 +1259,13 @@ def open_rasterio(
12511259 result .attrs ["_FillValue" ] = result .dtype .type (result .attrs ["_FillValue" ])
12521260
12531261 # handle encoding
1254- _handle_encoding (result , mask_and_scale , masked , da_name , unsigned = unsigned )
1262+ _handle_encoding (
1263+ result = result ,
1264+ mask_and_scale = mask_and_scale ,
1265+ masked = masked ,
1266+ da_name = da_name ,
1267+ unsigned = unsigned ,
1268+ )
12551269 # Affine transformation matrix (always available)
12561270 # This describes coefficients mapping pixel coordinates to CRS
12571271 # For serialization store as tuple of 6 floats, the last row being
0 commit comments