metno / esd

An R-package designed for climate and weather data analysis, empirical-statistical downscaling, and visualisation.
88 stars 30 forks source link

project.ds #197

Closed bschumac closed 7 years ago

bschumac commented 8 years ago

Hello, I want to use the esd package to predict monthly precipitation based on observations from 2000 - 2015. The predict.ds function returns just predictions for the already known years. If I try the project.ds function I get this error: "Error in rep("", n.app + 1) : invalid 'times' argument" The problem is, that the attribute n.app is not known in the eof series. Is there a fix for this? Thanks a lot Benjamin

brasmus commented 8 years ago

Hi Benjamin.

The attributes n.app and appendix are used in common EOFs and downscaling of common EOFs (You use combine to combine two fields before EOF).

predict.dswas designed to resemble the generic predict (see the newdataagrument), but you can use project.ds as a convenient way to project future precipitation based on GCM results.

bschumac commented 8 years ago

Okay maybe you can help me a little bit more when I post parts of my script here.

act_plot <- as.station.zoo(x= act_plot,stid=1,lon=plot_loc[1,]$Longitude, lat = plot_loc[1,]$Latitude, alt = 1000, cntr = "SA", quality= 3, param= "P_RT_NRT")

X <- retrieve.ncdf4(path="/home/benjamin/AG_Nauss/south_afica_IPSL_downscaling/data/netcdf", ncfile = "netcdf_pr_cut.nc", lat = -30.5, lon = 26.5) X <- annual.zoo(X)

cal <- subset (X, it=c(2011:2013)) pred <- subset (X, it=c(2014:2100)) comb <- combine(cal, pred)

eof <- EOF(comb) ds <- DS(y= act_plot,X=eof) proj_ds <- project.ds(ds, eof)

act_plot is a station with observations from 2006 to 2015. In the ncdf file there is data from 2006 - 2100. In ds is a Zoo time series from 2011 - 2013. project.ds is creating this error: Error in rep("", n.app + 1) : invalid 'times' argument. Could you tell me what I'm doing wrong? Thanks a lot (if I use eof.comb() i get this error: Error in order(attr(x, "latitude")) : argument 1 is not a vector)