@@ -213,15 +213,15 @@ def from_pandas(
213213 f"Cannot create { cls .__class__ .__name__ } instance from pandas indexes "
214214 "as required keys 'init_time', 'step', and 'variable' are not all present. "
215215 f"Got: '{ list (pd_indexes .keys ())} '" ,
216- )
216+ ),
217217 )
218218 if not all (len (pd_indexes [key ].to_list ()) > 0 for key in ["init_time" , "step" , "variable" ]):
219219 return Failure (
220220 ValueError (
221221 f"Cannot create { cls .__class__ .__name__ } instance from pandas indexes "
222222 "as the 'init_time', 'step', and 'variable' dimensions must have "
223223 "at least one coordinate value." ,
224- )
224+ ),
225225 )
226226 input_parameter_set : set [str ] = set (pd_indexes ["variable" ].to_list ())
227227 known_parameter_set : set [str ] = {str (p ) for p in Parameter }
@@ -233,7 +233,7 @@ def from_pandas(
233233 f"'{ list (input_parameter_set .difference (known_parameter_set ))} '. "
234234 "Ensure the parameter names match the names of the standard parameter set "
235235 "defined by the `entities.Parameter` Enum." ,
236- )
236+ ),
237237 )
238238 if not all (key in [f .name for f in dataclasses .fields (cls )] for key in pd_indexes ):
239239 unknown_keys : list [str ] = list (
@@ -243,7 +243,7 @@ def from_pandas(
243243 KeyError (
244244 f"Cannot create { cls .__class__ .__name__ } instance from pandas indexes "
245245 f"as unknown index/dimension keys were encountered: { unknown_keys } ." ,
246- )
246+ ),
247247 )
248248 if (
249249 "latitude" in pd_indexes
@@ -255,7 +255,7 @@ def from_pandas(
255255 "as the latitude values are not in descending order. "
256256 "Latitude coordinates should run from 90 -> -90. "
257257 "Modify the coordinate in the source data to be in descending order." ,
258- )
258+ ),
259259 )
260260 if (
261261 "longitude" in pd_indexes
@@ -267,7 +267,7 @@ def from_pandas(
267267 "as the longitude values are not in ascending order. "
268268 "Longitude coordinates should run from -180 -> 180. "
269269 "Modify the coordinate in the source data to be in ascending order." ,
270- )
270+ ),
271271 )
272272 if (
273273 "y_osgb" in pd_indexes
@@ -278,7 +278,7 @@ def from_pandas(
278278 "Cannot create NWPDimensionCoordinateMap instance from pandas indexes "
279279 "as the y_osgb values are not in descending order. "
280280 "Modify the coordinate in the source data to be in descending order." ,
281- )
281+ ),
282282 )
283283 if (
284284 "x_osgb" in pd_indexes
@@ -289,7 +289,7 @@ def from_pandas(
289289 "Cannot create NWPDimensionCoordinateMap instance from pandas indexes "
290290 "as the x_osgb values are not in ascending order. "
291291 "Modify the coordinate in the source data to be in ascending order." ,
292- )
292+ ),
293293 )
294294 if (
295295 "y_laea" in pd_indexes
@@ -300,7 +300,7 @@ def from_pandas(
300300 "Cannot create NWPDimensionCoordinateMap instance from pandas indexes "
301301 "as the y_laea values are not in descending order. "
302302 "Modify the coordinate in the source data to be in descending order." ,
303- )
303+ ),
304304 )
305305 if (
306306 "x_laea" in pd_indexes
@@ -311,7 +311,7 @@ def from_pandas(
311311 "Cannot create NWPDimensionCoordinateMap instance from pandas indexes "
312312 "as the x_laea values are not in ascending order. "
313313 "Modify the coordinate in the source data to be in ascending order." ,
314- )
314+ ),
315315 )
316316
317317 # Convert the pandas Index objects to lists of the appropriate types
@@ -346,7 +346,7 @@ def from_pandas(
346346
347347 @classmethod
348348 def from_xarray (
349- cls , xarray_obj : xr .DataArray | xr .Dataset
349+ cls , xarray_obj : xr .DataArray | xr .Dataset ,
350350 ) -> ResultE ["NWPDimensionCoordinateMap" ]:
351351 """Create a new NWPDimensionCoordinateMap from an XArray DataArray or Dataset object."""
352352 return cls .from_pandas (xarray_obj .coords .indexes ) # type: ignore
@@ -566,7 +566,7 @@ def as_zeroed_dataarray(self, name: str, chunks: dict[str, int]) -> xr.DataArray
566566 (
567567 f"nwp-consumer { __version__ } at " ,
568568 f"{ dt .datetime .now (tz = dt .UTC ).strftime ('%Y-%m-%d %H:%M' )} " ,
569- )
569+ ),
570570 ),
571571 "variables" : json .dumps (
572572 {
@@ -575,7 +575,7 @@ def as_zeroed_dataarray(self, name: str, chunks: dict[str, int]) -> xr.DataArray
575575 "units" : p .metadata ().units ,
576576 }
577577 for p in self .variable
578- }
578+ },
579579 ),
580580 "coord_system" : json .dumps (self .coord_system ),
581581 }
@@ -614,7 +614,7 @@ def crop(
614614 "Cannot crop coordinates to a region as latitude and/or longitude "
615615 "dimension coordinates are not present in the map. "
616616 f"Dimensions: '{ self .dims } '." ,
617- )
617+ ),
618618 )
619619
620620 if not (- 90 <= south < north <= 90 and - 180 <= west < east <= 180 ):
@@ -625,7 +625,7 @@ def crop(
625625 " and both must sit between 90 and -90 degrees; "
626626 f"East ({ east } ) greater than West ({ west } ) "
627627 " and both must sit between 180 and -180 degrees." ,
628- )
628+ ),
629629 )
630630
631631 if (
@@ -639,7 +639,7 @@ def crop(
639639 "Cannot crop coordinates to a region outside the bounds of the map. "
640640 f"Crop region '{ north , west , south , east } ' not in "
641641 f"map bounds '{ self .nwse ()} '." ,
642- )
642+ ),
643643 )
644644
645645 # Determine the indices of the region in the latitude and longitude lists
@@ -652,7 +652,7 @@ def crop(
652652 self ,
653653 latitude = [self .latitude [i ] for i in lat_indices ],
654654 longitude = [self .longitude [i ] for i in lon_indices ],
655- )
655+ ),
656656 )
657657
658658 def nwse (self ) -> tuple [float , float , float , float ]:
0 commit comments