pacificclimate / climdex.pcic.ncdf

R package to compute Climdex indices on gridded NetCDF files
GNU General Public License v3.0
15 stars 13 forks source link

Calculate indices with new thresholds - Error #14

Open AlvaroAvila360 opened 5 years ago

AlvaroAvila360 commented 5 years ago

captura de tela de 2019-02-04 21-14-34

Hello everyone, I have a problem with the calculation indices with new thresholds using thresholds contained in a specific file with climdex.pcic.ncdf package. I can calculate the thresholds but I Can not calculate the indices with new thresholds This is the error:

Error in FUN(X[[i]], ...) : Temperature in-base quantiles must contain 10th and 90th percentiles.

Please someone can help me? Many thanks in advance.

I wrote the next script.

require(climdex.pcic.ncdf)

calculate thresholds --- I can calculate the thresholds

input.files <- c("tasmax_day_rcp85-area_r1i1p1_1-CanESM2_20160101-20351231.nc","tasmin_day_rcp85-area_r1i1p1_1-CanESM2_20160101-20351231.nc","pr_day_rcp85-area_r1i1p1_1-CanESM2_20160101-20351231.nc") author.data <- list(institution="University") create.thresholds.from.file(input.files, "thresholds.nc", author.data, base.range=c(2016,2025), parallel=FALSE)

calculate indices with new thresholds – I can not calculate the indices with new ###thresholds

input.files <- c("tasmax_day_rcp85-area_r1i1p1_1-CanESM2_20160101-20351231.nc","tasmin_day_rcp85-area_r1i1p1_1-CanESM2_20160101-20351231.nc","pr_day_rcp85-area_r1i1p1_1-CanESM2_20160101-20351231.nc") author.data <- list(institution="University"") create.indices.from.files(input.files, "Results/", input.files[1], author.data, base.range=c(2016, 2025), parallel=8, thresholds.files="thresholds.nc", max.vals.millions = 10, cluster.type = "SOCK")

fanxw1121 commented 4 years ago

hi Have you solved this problem? I've also met this problem now. Can you share your solution? Thank you

AlvaroAvila360 commented 4 years ago

Hey Fanx, Yes, I Solved the problem. You must use a different period than the one you use in the base.range=c(2016,2025), For example you file is "tasmax_day_rcp85-area_r1i1p1_1-CanESM2_20160101-20351231.nc" The base.range has to be outside the period you want to study (e.g., base.range=c(1986,2005))

Regards Alvaro.

fanxw1121 commented 4 years ago

Hey Alvaro Thanks for your help.I will do in your way. Best wishes Fan

发自我的iPhone

------------------ Original ------------------ From: Alvaro Avila <notifications@github.com> Date: Tue,Jan 28,2020 11:48 PM To: pacificclimate/climdex.pcic.ncdf <climdex.pcic.ncdf@noreply.github.com> Cc: fanxw1121 <1269914425@qq.com>, Comment <comment@noreply.github.com> Subject: Re: [pacificclimate/climdex.pcic.ncdf] Calculate indices with new thresholds - Error (#14)

Hey Fanx, Yes, I Solved the problem. You must use a different period than the one you use in the base.range=c(2016,2025), For example you file is "tasmax_day_rcp85-area_r1i1p1_1-CanESM2_20160101-20351231.nc" The base.range has to be outside the period you want to study (e.g., base.range=c(1986,2005))

Regards Alvaro.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

fanxw1121 commented 10 months ago

谢谢,我已收到邮件,尽快给您回复。

ADATHIAN513 commented 10 months ago

I want to calculate heatwaves using Climpact, but I always have this error displaying: Erreur dans check.quantile.validity(quantiles, present.var.list, days.in.base) : Temperature in-base quantiles must contain 10th and 90th percentiles. my code is year ################climdex.pcic.ncdf########################################## library(climdex.pcic.ncdf)

List of one to three input files

input.files = c("/media/adamathiandoum/Crucial X6/CMIP6-Merge/BCC-CSM2-MR/pr_tasmax_tasmin_day_ACCESS-CM2_ssp245_r1i1p1f1_conv_WA_1981-2010.nc")

List of variable names according to above file(s)

vars = c(tmax = "tasmax", tmin = "tasmin", prec = "pr")

Output file name

output.file = "/media/adamathiandoum/Crucial X6/CMIP6-Merge/BCC-CSM2-MR"

Accorder toutes les permissions au fichier créé

Sys.chmod(output.file, mode = "777")

Output filename format. Must use CMIP5 filename convention. i.e. "var_timeresolution_model_scenario_run_starttime-endtime.nc"

file.template="var_day_BCC-CSM2-MR_historical_r1i1p1f1_1981-2010.nc"

author data

author.data=list(institution="My University", institution_id="MU")

reference period

base.range=c(1981,2010)

number of cores to use, or FALSE for single core.

cores=FALSE

list of indices to calculate, or NULL to calculate all.

indices= c("hw","tn90p","tx90p", "wsdi")

input threshold file to use, or NULL for none.

thresholds.files= "/media/adamathiandoum/Crucial X6/CMIP6-Merge/BCC-CSM2-MR/thresholds.test.1981-2010.nc"

Directory where Climpact is stored. Use full pathname. Leave as NULL if you are running this script from the Climpact directory (where this script was initially stored).

root.dir= "/home/adamathiandoum/climpact-master"

definition used for Excess Heat Factor (EHF). "PA13" for Perkins and Alexander (2013), this is the default. "NF13" for Nairn and Fawcett (2013).

EHF_DEF = "PA13"

axis to split data on. For chunking up of grid, leave this.

axis.name="Y"

Number of data values to process at once. If you receive "Error: rows.per.slice >= 1 is not TRUE", try increasing this to 20. You might have a large grid.

maxvals=21

output compatible with FCLIMDEX. Leave this.

fclimdex.compatible=FALSE

Call the package.

create.indices.from.files(input.files,output.file,file.template,author.data,variable.name.map=vars,base.range=base.range,parallel=cores,axis.to.split.on=axis.name,climdex.vars.subset=indices,thresholds.files=thresholds.files,fclimdex.compatible=fclimdex.compatible,root.dir=root.dir, cluster.type="SOCK",ehfdef=EHF_DEF,max.vals.millions=maxvals,wsdin_n=5,csdin_n=5,hddheatn_n=18,cddcoldn_n=18,gddgrown_n=10,rxnday_n=7,rnnmm_n=30,ntxntn_n=3,ntxbntnb_n=3,project.lat2d.coords=TRUE, thresholds.name.map=c(tx05thresh="tx05thresh",tx10thresh="tx10thresh", tx50thresh="tx50thresh", tx90thresh="tx90thresh",tx95thresh="tx95thresh", tn05thresh="tn05thresh",tn10thresh="tn10thresh",tn50thresh="tn50thresh",tn90thresh="tn90thresh",tn95thresh="tn95thresh", tx90thresh_15days="tx90thresh_15days",tn90thresh_15days="tn90thresh_15days",tavg90thresh_15days="tavg90thresh_15days", tavg05thresh="tavg05thresh",tavg95thresh="tavg95thresh", txraw="txraw",tnraw="tnraw",precraw="precraw", r95thresh="r95thresh", r99thresh="r99thresh"))