sbegueria/SPEIbase

Error in NCtoText

Closed this issue · 3 comments

Hello,

First of all thank you very much for the code for the computation of the SPEI, they were very useful and worked perfectly.

I have downloaded 4 times scales of the index (01,03,06 and 12), however the file to convert from NC to text requires to have all 48 time scales if I understand well.

In this light, I get an error message when running this R script.
Error : "Error in d[[s]] : out of range index
Called from: ncvar_get(d[[s]], "spei", c(x, y, 1), c(1, 1, -1))"

When I try to run with debug, the traceback seems to say that the error comes from the ncvar_get function which is in read-only so I cannot modify it to make it work for my 4 time scales only.

Would you happen to know what I can do to modify the code / find another solution in order to get the data in CSV?

Thank you very much.

Hello, I am facing the exact same issue and was wondering how you managed to solve it!

Thanks a lot :)

Have you tried changing 48 (it is hard-coded) with your desired maximum time scale?

I did and it worked :)

However, I have another issue, the order of the latitudes and longitudes is wrong (lat comes first) and is causing issues when reading the file in QGIS. I want to change this in the nc file without writing to text but so far I wasn't able to do it since these are not really variables but more like functions (loosely speaking). Any ideas?

Thanks a lot!