SantanderMetGroup / climate4R.climdex

A climate4R package for calculation of the ETCCDI core climate indices (part of the climate4R bundle)
https://github.com/SantanderMetGroup/climate4R
GNU General Public License v3.0
2 stars 4 forks source link

climdexGrid does not take station data input? #3

Open cicatrixx opened 5 years ago

cicatrixx commented 5 years ago

Does climdexGrid not take climate4R station data type? I tried the following:

download.file("http://meteo.unican.es/work/loadeR/data/VALUE_ECA_86_v2.tar.gz", destfile = "VALUE_ECA_86_v2.tar.gz")
untar("VALUE_ECA_86_v2.tar.gz")
value <- "VALUE_ECA_86_v2"
example1 <- loadStationData(dataset = value, var="tmax", stationID = c("000234", "003946"), years = 1981:2000)
SU1<-climdexGrid(tx=example1, index.code="SU")

which gives the following error message: Error in aperm.default(array3D, match(c("time", "lat", "lon"), dimNames)) : perm is of wrong length 3 (!= 2)

jbedia commented 5 years ago

Hi, thanks for reporting! We developed the package thinking in grid data, but everything should work seamlessly with stations. We will have a look to this asap. Best regards

jbedia commented 5 years ago

Hi, I have just included support for station data. See the examples section of climdexGrid, using the VALUE dataset. In case any problems arise just let us know. Best regards.

cicatrixx commented 5 years ago

Hi @jbedia, I reinstalled climate4R.climdex and ran the VALUE dataset example but I get errors as follows:

cwd <- climdexGrid(index.code = "CWD", pr = station.data)
[2018-12-21 11:44:50] Calculating CWD ...
Error in as.POSIXlt.character(x, tz, format, ...) : 
  character string is not in a standard unambiguous format
jbedia commented 5 years ago

Hi @cicatrixx . I am unable to reproduce the problem. The example is running fine in my computer after reinstalling from master. Does the problem persist after reinstall and restart? Could you at least send the trace?

cicatrixx commented 5 years ago

I reinstalled and restarted and tried running the example in R and Rstudio. But I still get the same error. I have not used traces before, sorry I am relatively new in R. But attached is the output when I call traceback() after I get the error for climdexGrid(). Is that helpful? Else can you please instruct on how to generate the trace you are looking for? Thanks! traceback_output.txt