ISI-MIP / attrici

Produce counterfactual climates for ISIMIP.
GNU General Public License v3.0
9 stars 2 forks source link

IndexError in run_estimation.py, "df_specs["lat"] = latgrid[ls_mask == 1]" #84

Closed A-Buch closed 1 year ago

A-Buch commented 1 year ago

Hi all,

running run_estiamtion.py causes an IndexError in df_specs["lat"] = latgrid[ls_mask == 1]

(line 60): 
IndexError: boolean index did not match indexed array along dimension 0; dimension is 9 but corresponding boolean dimension is 720
The shape of ls_mask.: (720,0)
The shape of latgrid: (9,18)

I adapted previously the variable of nc_lsmask from LSM to mask, i assume it's the same variable just with another name

ls_mask = nc_lsmask.variables["mask"][0, :] (line 58)

Maybe it's because of the shape of the provided subset data, but i am not sure, i will have a closer look into the variables.

SimonTreu commented 1 year ago

Ah, that's my mistake. The landseamask file is still the full 0.5 degree global grid while the pr and tas files contain only every 40th grid cell. I will upload an updated landseamask file.

SimonTreu commented 1 year ago

I produced a land-sea mask file landseamask_sub40.nc matching the grid of pr_gswp3-w5e5_sub40.nc4 and tas_gswp3-w5e5_sub40.nc4 with this cdo command:

cdo samplegrid,40 landseamask.full.nc landseamask_sub40.nc

change the landsea_file variable in settings.py to

landsea_file = "landseamask_sub40.nc" 

You may close this issue if the error is resolved

A-Buch commented 1 year ago

Ah great thanks, i will try it with the new land sea mask

SimonTreu commented 1 year ago

Sorry forgot to push... Now its there 93efe23fdb84e7d958a4d969aaffefed2914eb6d