monocongo/climate_indices

Calculate the SPI from an xr.dataset from Python (instead of command line)

Closed this issue · 3 comments

Describe the bug
I used the script below shared in issue #326 but I can not figure out the error that raises.
Following you will find a screenshot of my code, error, and a link to my dataset.

Screenshots
image
image
image
image
image
image

Link to dataset
https://drive.google.com/file/d/1tT8kYP1bT8YutZZs4vf8zi6DtN86Fd8e/view?usp=sharing

Desktop (please complete the following information):

  • Windows
  • 10

Additional context
The script runs fine when the values of the latitude are transposed (i.e from 10.75 to 12.75 degrees), however, these values should be in the correct order (i.e from 12.75 to 10.75 degrees)

I get the same issue when computing the PET. It works with the incorrect order of latitude values

I have run into this before as well. It is a bug/feature of xarray and is not an issue with this package's code, as far as I can tell. I would instead raise this issue in the xarray issue tracker, as someone there who is more familiar with xarray will likely be able to help you. If it's working OK with the latitude values in what you consider to be the wrong order then just reorder the latitude values after it's finished computing the index.

It worked just fine! Thank you for the recommendation, I'm closing this issue.