[R] NCDF_arrays

Sibylle Stöckli sibylle.stoeckli at gmx.ch
Mon Aug 3 10:24:15 CEST 2015


Dear R-users

I am working with ncdf data using the variables time (1-365), lon (longitude), lat (latitude) and the Temperature variable  daily). After setting the parameters for the model, I am able to calculate the output for each lon-lat grid point. The model works well including one ncdf file (TabsD29) (1). Now I want to include more than one ncdf file (2). Alls the ncdf files have the same variables with exception of the temperature variable. However, I get the output "wrong arrays".  I think may suggestion to calculate the mean is wrong? 

Many thanks
Sibylle


 nlon <- length(lon)
 nlat <- length(lat)
 nday <- length(TabsD29[1,1,])

 Tmin     <- 10.
 GDDmax   <- 145
 DOYstart <- 1
 
 (1)
 Teffs   <- pmax(TabsD29 - Tmin, array(0., dim=c(nlon, nlat, nday))) 

(2)

 
 Teff   <- pmax(mean(as.numeric(TabsD80+TabsD81+TabsD82+TabsD83+TabsD84+TabsD85+TabsD86+TabsD87+TabsD88+TabsD89+TabsD90+TabsD91+TabsD92+TabsD93+TabsD94+TabsD95+TabsD96+TabsD97+TabsD98+TabsD99+TabsD20+TabsD21+TabsD22+TabsD23+TabsD24+TabsD25+TabsD26+TabsD27+TabsD28+TabsD29)) - Tmin, array(0., dim=c(nlon, nlat, nday)), na.rm=TRUE) 
	[[alternative HTML version deleted]]



More information about the R-help mailing list