Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Quantiles for tmax and tmin missing #3

Closed
tammasloughran opened this issue Mar 27, 2015 · 4 comments
Closed

Quantiles for tmax and tmin missing #3

tammasloughran opened this issue Mar 27, 2015 · 4 comments

Comments

@tammasloughran
Copy link

I'm trying out version 0.2 on AWAP. I installed SPEI in R and it seemed to work but it also returned an error: Error in -install.packages("SPEI") : invalid argument to unary operator This may be unrelated.

My script:

# Testing template for climpact.loader
source("climpact2_0.2.r")

indices=c("txx")
minfilename = "/srv/ccrc/data35/z5032520/AWAP/daily/tmin/tmin_2000.nc"
maxfilename = "/srv/ccrc/data35/z5032520/AWAP/daily/tmax/tmax_2000.nc"
#precfilename = "/srv/ccrc/data43/z3506872/datasets/sample_narclim/CCRC_NARCliM_DAY_1950-2009_pracc_fl.nc"

climpact.loader(
time_format = "%Y%m%d",
tsminfile=minfilename,
tsmaxfile=maxfilename,
tsminname="tmin",
tsmaxname="tmax",
indices=indices,
identifier="AWAP_tmax_test")

Returns:

z5032520@cyclone:~/climpact2$ Rscript test.climpact2.r 
Loading required package: PCICt
Loading required package: methods
Loading required package: lmomco
Loading required package: parallel
# Package SPEI (1.6) loaded [try SPEINews()].
[1] "********* CALCULATING INDICES"
[1] "array(indexcompile(cio,freq=\"monthly\"))"
Error in validObject(.Object) : 
  invalid class "climdexInput" object: 1: Quantiles for tmax are missing.
invalid class "climdexInput" object: 2: Quantiles for tmin are missing.
Calls: climpact.loader ... cicompile -> new -> initialize -> initialize -> validObject
Execution halted

Is there something I'm missing?

@heroldn
Copy link
Contributor

heroldn commented Mar 27, 2015

Thanks for pointing this out. I think this actually relates to a tiny bug in climdex where quantiles are hard coded (the maintainer knows about the bug but it isn't rolled into the current CRAN release).
Can you try the following procedure;

  • download the tar.gz file I've just put on git in the main directory.
  • then in R run: remove.packages("climdex.pcic")
  • then run: install.packages("/directory/to/climdex.tar.gz",repos=NULL,type="source")

This reinstalls climdex using the tweak. Then try your script again. Even if this doesn't work you will need the above re-install for other indices. I'll change the instructions in the install.txt. Sorry for the inconvenience!

@tammasloughran
Copy link
Author

Thanks Nick! I'll update my packages before I try any other indices.
Otherwise, I actually fixed this problem. I was originally using only 1 year of data, 2000. So I tried a longer dataset 1911-2014 and it worked.

Loading required package: PCICt
Loading required package: methods
Loading required package: lmomco
Loading required package: parallel
# Package SPEI (1.6) loaded [try SPEINews()].
[1] "********* CALCULATING INDICES"
[1] "array(indexcompile(cio,freq=\"monthly\"))"
[1] 1248
[1] "climdex.txx completed."

The only explanation I can think of is that there is some base period that is needed over which these quartiles are are calculated and probably other things like thresholds. I dont think txx really needs this since its just the hottest event of the month. So, it might be a good idea to look into the minimum period that is needed for particular indices and if possible create conditions in the code for when a base period is not needed such as txx. Also some documentation on what period is needed would be good.

@heroldn
Copy link
Contributor

heroldn commented Mar 27, 2015

Yep, exactly right. The .tar.gz I uploaded fixes that problem (but also
removes another check it was performing). Anyway, I'll think about this
more down the track. Glad to hear it's working.

Nick.

On Fri, Mar 27, 2015 at 2:41 PM, Tammas Loughran notifications@github.com
wrote:

Thanks Nick! I'll update my packages before I try any other indices.
Otherwise, I actually fixed this problem. I was originally using only 1
year of data, 2000. So I tried a longer dataset 1911-2014 and it worked.

Loading required package: PCICt
Loading required package: methods
Loading required package: lmomco
Loading required package: parallel

Package SPEI (1.6) loaded [try SPEINews()].

[1] "********* CALCULATING INDICES"
[1] "array(indexcompile(cio,freq="monthly"))"
[1] 1248
[1] "climdex.txx completed."

The only explanation I can think of is that there is some base period that
is needed over which these quartiles are are calculated and probably other
things like thresholds. I dont think txx really needs this since its just
the hottest event of the month. So, it might be a good idea to look into
the minimum period that is needed for particular indices and if possible
create conditions in the code for when a base period is not needed such as
txx. Also some documentation on what period is needed would be good.


Reply to this email directly or view it on GitHub
#3 (comment).

@tammasloughran
Copy link
Author

Ok, I'll go ahead and close this then.

nichannah pushed a commit to nichannah/climpact2 that referenced this issue Jun 1, 2017
update documentation, add correlation plots link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants