Skip to content

Commit 62bf337

Browse files
authored
Merge pull request #98 from rubisco-sfa/update-gfed
FIX: GFED and other problems reading in multifile datsets
2 parents 1662e9f + 54ad4e4 commit 62bf337

File tree

8 files changed

+18
-16
lines changed

8 files changed

+18
-16
lines changed

ilamb3/analysis/area.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ def __call__(
190190
)
191191
]
192192
)
193-
print(df)
194193
return df, ref_.rename({varname: "extent"}), com_.rename({varname: "extent"})
195194

196195
def plots(

ilamb3/cli/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def run(
8989
config: Path,
9090
regions: str | None = None,
9191
region_sources: list[str] | None = None,
92-
df_comparison: Path | None = None,
92+
df_comparison: list[Path] | None = None,
9393
output_path: Path = Path("_build"),
9494
cache: bool = True,
9595
central_longitude: float = 0.0,
@@ -121,7 +121,8 @@ def run(
121121
if df_comparison is None:
122122
df_com = _dataframe_cmip()
123123
else:
124-
df_com = pd.read_csv(df_comparison)
124+
df_comparison = [Path(f) for f in str(df_comparison[0]).split(",")]
125+
df_com = pd.concat([pd.read_csv(f) for f in df_comparison])
125126

126127
# execute
127128
if HAS_MPI4PY:

ilamb3/configure/ilamb.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@ Ecosystem and Carbon Cycle:
5353

5454
Burnt Area:
5555

56-
GFED4.1S:
56+
GFED-5-0:
5757
sources:
58-
burntArea: burntArea/GFED4.1S/burntArea.nc
58+
burntFractionAll: GFED-5-0/obs4MIPs_NASA-NOSR_GFED-5-0_mon_burntFractionAll_gr_v20251029.nc
5959
variable_cmap: YlOrBr
60-
alternate_vars:
61-
- burntFractionAll
6260

6361
Gross Primary Productivity:
6462

@@ -248,7 +246,7 @@ Hydrology Cycle:
248246
hfss: hfss/FLUXCOM/hfss.nc
249247
variable_cmap: Blues
250248

251-
WECANN:
249+
WECANN-1-0:
252250
sources:
253251
hfss: WECANN-1-0/obs4MIPs_ColumbiaU_WECANN-1-0_mon_hfss_gn_v20250902.nc
254252
variable_cmap: Blues

ilamb3/dataset.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,10 +729,13 @@ def _get_interval(dset, dim, value, side): # numpydoc ignore=GL08
729729
if "bounds" in coord.attrs:
730730
if coord.attrs["bounds"] in dset:
731731
coord = dset[coord.attrs["bounds"]]
732+
coord.load()
732733
ind = ((coord[:, 0] <= value) & (coord[:, 1] >= value)).to_numpy()
733734
ind = np.where(ind)[0]
734-
assert len(ind) <= 2
735-
assert len(ind) > 0
735+
if len(ind) not in [1, 2]:
736+
raise ValueError(
737+
f"We could not find an appropriate interval for {value} in \n{coord}"
738+
)
736739
if len(ind) == 2:
737740
if side == "low":
738741
return ind[1]

ilamb3/registry/ilamb.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ biomass/Saatchi2011/biomass_0.5x0.5.nc sha1:af0dad922bc2d174293a22ab374b8662220f
66
biomass/Thurner/biomass_0.5x0.5.nc sha1:d76bb837865b8bb4ed42ddd04a20454ed68db9bb
77
biomass/USForest/biomass_0.5x0.5.nc sha1:cde74c443271f3e98d7d59e2c827e686a5abe95f
88
biomass/XuSaatchi2021/XuSaatchi.nc sha1:244543e731dfd46f9842d6e40f4a2eeead122ee3
9-
burntArea/GFED4.1S/burntArea.nc sha1:cf9d73c6a8bfc594737c9ba6ca4df613df4a28ab
109
cSoil/HWSD/soilc_0.5x0.5.nc sha1:5dd084a66a7e0d0b4ca6125db47af0eb0c119377
1110
cSoil/HWSD2/hwsd2_cSoil.nc sha1:9a6377e4c5ff457c08c194d2c376c46e003a4f84
1211
cSoil/Koven/fracpeat_0.5x0.5.nc sha1:fa7cab1379c66baf7c1977d3c4c676ee9678de49

ilamb3/registry/ilamb3.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ WECANN-1-0/obs4MIPs_ColumbiaU_WECANN-1-0_mon_hfls_gn_v20250902.nc sha1:380cea38e
55
Hoffman-1-0/obs4MIPs_UCI-ORNL_Hoffman-1-0_yr_fgco2_gm_v20250903.nc sha1:f06d909348c05fdea0a7af87b01bfd4cb440e075
66
Hoffman-1-0/obs4MIPs_UCI-ORNL_Hoffman-1-0_yr_nbp_gm_v20250903.nc sha1:803453d7b3873732190b1a20b25c4b50d34642c9
77
HWSD-2-0/obs4MIPs_IIASA-FAO_HWSD-2-0_fx_cSoil_gn_v20250903.nc sha1:9855622a525902f0e2625ee6293e8d7c2b18c24c
8+
GFED-5-0/obs4MIPs_NASA-NOSR_GFED-5-0_mon_burntFractionAll_gr_v20251029.nc sha1:0527f07ae72ea9520486f7f3d47f8ec26a7a017f
89
RAPID-2023-1a/obs4MIPs_NOC_RAPID-2023-1a_mon_msftmz_gm_v20250902.nc sha1:0dfeea11872bdc453cf5d0a3b0cf1abf4d14369f
910
WOA-23/obs4MIPs_NOAA-NCEI-OCL_WOA-23_monC_si_gn_v20250902.nc sha1:a51b67b0eb874ddd40ecb25cf9c087005186b74f
1011
WOA-23/obs4MIPs_NOAA-NCEI-OCL_WOA-23_monC_thetao_gn_v20250902.nc sha1:a5466f4b53b4d3a840b9a372be2cd4be8a0e5280

ilamb3/run.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,8 @@ def _load_comparison_data(
357357
var: xr.open_mfdataset(
358358
sorted((df[df["variable_id"] == var]["path"]).to_list()),
359359
preprocess=fix_lndgrid_coords,
360-
data_vars="all",
360+
data_vars=None,
361+
compat="no_conflicts",
361362
)
362363
for var in df["variable_id"].unique()
363364
}

ilamb3/transform/select.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212

1313
class select_dim(ILAMBTransform):
1414
"""
15-
Select a depth if the dimension exists.
15+
Select a value or slice in the dimension if the dimension exists.
1616
1717
Parameters
1818
----------
1919
dim : str
2020
The dimension.
2121
value : float
22-
The value at which to select the nearest depth.
22+
The value at which to select the nearest dimension.
2323
vmin : float
24-
The minimum depth to slice.
24+
The minimum value to slice.
2525
vmax : float
26-
The maximum depth to slice.
26+
The maximum value to slice.
2727
2828
Note
2929
----

0 commit comments

Comments
 (0)