Skip to content

Commit a4a0724

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent e904a24 commit a4a0724

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

src/ravenpy/config/commands.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,8 @@ class ReadFromNetCDF(FlatCommand):
853853
@field_validator("dim_names_nc")
854854
@classmethod
855855
def reorder_time(cls, v):
856-
"""Return dimensions as x, y, t.
856+
"""
857+
Return dimensions as x, y, t.
857858
858859
This is a fail safe because if input files are CF-compliant, dimensions should already
859860
have been ordered by `nc_specs`.

src/ravenpy/config/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ def get_annotations(a):
188188

189189

190190
def infer_dim_names(da: xr.DataArray) -> tuple:
191-
"""Return names of dimensions in dataset in order expected by Raven.
191+
"""
192+
Return names of dimensions in dataset in order expected by Raven.
192193
193194
If 3D, return X, Y, T axes names if they can be inferred from CF conventions.
194195
If 2D, return STATION, T

tests/test_utils.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,19 @@ def test_nc_specs(yangtze):
1717
assert attrs["dim_names_nc"] == ("time",)
1818

1919
# 2D with station dimension
20-
f = get_local_testdata(
21-
"raven-gr4j-cemaneige/Salmon-River-Near-Prince-George_meteo_daily_2d.nc"
22-
)
20+
f = get_local_testdata("raven-gr4j-cemaneige/Salmon-River-Near-Prince-George_meteo_daily_2d.nc")
2321
attrs = nc_specs(f, "PRECIP", station_idx=1, alt_names=("rain",))
2422
assert attrs["dim_names_nc"] == (
2523
"region",
2624
"time",
2725
)
2826

2927
# 3D - Since this file is not CF compliant, nc_specs cannot infer the correct dimension order
30-
f = get_local_testdata(
31-
"raven-gr4j-cemaneige/Salmon-River-Near-Prince-George_meteo_daily_3d.nc"
32-
)
28+
f = get_local_testdata("raven-gr4j-cemaneige/Salmon-River-Near-Prince-George_meteo_daily_3d.nc")
3329
attrs = nc_specs(f, "PRECIP", station_idx=1, alt_names=("rain",))
3430
assert attrs["dim_names_nc"] == ("time", "lon", "lat")
3531

36-
f = get_local_testdata(
37-
"cmip5/tas_Amon_CanESM2_rcp85_r1i1p1_200601-210012_subset.nc"
38-
)
32+
f = get_local_testdata("cmip5/tas_Amon_CanESM2_rcp85_r1i1p1_200601-210012_subset.nc")
3933
attrs = nc_specs(f, "TEMP_AVE", station_idx=1, engine="netcdf4")
4034
assert attrs["dim_names_nc"] == ("lon", "lat", "time")
4135

0 commit comments

Comments
 (0)