Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

climpact and climdex.pcic.ncdf do not compute SPI and SPEI #91

Open
user241276 opened this issue Nov 17, 2021 · 9 comments
Open

climpact and climdex.pcic.ncdf do not compute SPI and SPEI #91

user241276 opened this issue Nov 17, 2021 · 9 comments

Comments

@user241276
Copy link

hello @heroldn @jmccomb @lisavalexander,

I am using both climpact and climdex.pcic.ncdf for computing indices for CMIP6 data. My input files are netcdfs with tasmax, tasmin and pr variables from 1950 to 2100.

The computation of the indices works fine but not for the SPI and SPEI indices.

Please see below an example if I do cdo info on one SPEI output (same applies for SPI):

[XXPP@log test]$ cdo info spei_MON_cmip6_ssp126_ACCESS-CM2_1950-2100.nc
Warning (cdfScanVarAttr): Time must be the first dimension! Unsupported array structure, skipped variable spei!
Warning (cdf_set_var): Inconsistent variable definition for spei!
Warning (cdfInqContents): No data arrays found!
cdo    info: Open failed on >spei_MON_cmip6_ssp126_ACCESS-CM2_1950-2100.nc<
             Unsupported file structure

Looks like the aren't any data in the netcdf file.

What am I missing?

Thanks

@heroldn
Copy link
Contributor

heroldn commented Nov 19, 2021 via email

@user241276
Copy link
Author

user241276 commented Nov 19, 2021

hello, thanks a lot for the support.

I tried with ncks -d scale,0 -v spi climpact_spi_file.nc test.nc but I still get an empty output.

see attached a ncview screenshot of test.nc
Screenshot 2021-11-19 at 10 50 54

a cdo info on the same file:

[XXxDD@log dir]$ cdo info test.nc
Warning (cdfScanVarAttr): Time must be the first dimension! Unsupported array structure, skipped variable spi!
Warning (cdf_set_var): Inconsistent variable definition for spi!
Warning (cdfInqContents): No data arrays found!
cdo    info: Open failed on >test.nc<
             Unsupported file structure

I also tested it with a longer bas-range of 30 years but results are the same (now I am using 20y base-range).

@heroldn
Copy link
Contributor

heroldn commented Nov 19, 2021 via email

@user241276
Copy link
Author

thanks. It makes sense :)

I tried an example with SPI3 and cdo and it does not work:

[aaaa@log dir]$ cdo seltimestep,3/30 test.nc out.nc
Warning (cdfScanVarAttr): Time must be the first dimension! Unsupported array structure, skipped variable spi!
Warning (cdf_set_var): Inconsistent variable definition for spi!
Warning (cdfInqContents): No data arrays found!
cdo    seltimestep: Open failed on >test.nc<
                    Unsupported file structure

Then tried the same with NCO but when plotting with ncview I only have one SPI3 value:

[aaaa@log dir]$ ncks -d time,3,30 test.nc out.nc
[aaaa@log dir]$ ncview out.nc

Screenshot 2021-11-19 at 12 38 23

Is it 'normal' that ncview cannot plot the SPI?
How can I access the data inside test.nc?

Thanks

@heroldn
Copy link
Contributor

heroldn commented Nov 19, 2021

It looks like you have more than one SPI3 value. Are you sure you're looking at the time dimension? It goes from 36104.5 to 36914.5. You don't need to extract those timesteps with CDO/NCO either, just use ncview and move forward in the time dimension by clicking the box I've circled in red.
image

@user241276
Copy link
Author

great. it works :) thank you

@user241276
Copy link
Author

p.s. to make the file "test.nc" work with CDO, the dimension "scale" needs to be removed from SPI3, SPI6 or/and SPI12. This can be done with NCO:

ncwa -a scale test.nc out.nc

best

@heroldn
Copy link
Contributor

heroldn commented Nov 19, 2021

Yes true. Good to hear you can access the data.

@heroldn heroldn closed this as completed Nov 19, 2021
@heroldn heroldn reopened this Nov 19, 2021
@ADATHIAN513
Copy link

I need help calculating SPEI/SPI. When I use the Climpact function to add 1-month and 24-month scales, it doesn't work as expected. Has anyone encountered this problem before, or would you have a solution for integrating these scales into the index calculation?
Thanks in advance for your help!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants