Skip to content

Trouble shooting

Rasmus E. Benestad edited this page Mar 30, 2015 · 13 revisions

First thing if you have a problem, try to run the function with verbose set to TRUE, if there is a verbose argument. E.g.

normal.period <- subset(Oslo,it=c(1961,1990),verbose=TRUE)

The messages produced may give you a clue about the problem. Also try the examples provided in the manual, if you can find it (e.g. type ?subset'). Try to do the analysis with the data provided in esd`. The problem may be that the data structure is not quite right, that some attributes are missing, etc. Often the problem can be fixed re-setting the attributes.

The esd package comes with some sample data like Oslo, Ferder, bjornholt, NACD (station(src='nacd')) and large-scale filtered versions of some reanalyses (see eg ?t2m.NCEP). If you have troubles, then you can try to repeat the analysis with data objects provided in esd to see if the problem is related to the structure of the data objects - sometimes a mis-specified attribute may cause the the analysis to halt.

Problem reading in netCDF data

One solution is to read in the data 'manually':

## Sea surface temperature data from http://www.esrl.noaa.gov/psd/data/gridded/data.noaa.oisst.v2.html
  ncid <- nc_open('sst.mnmean.nc')
  x <- ncvar_get(ncid,'sst')
  lon <-  ncvar_get(ncid,'lon')
  lat <-  ncvar_get(ncid,'lat')
  tim <-  ncvar_get(ncid,'time')
  nc_close(ncid)
  ncid <- nc_open('/disk1/lsmask.nc')
  lsm <- ncvar_get(ncid)
  nc_close(ncid)
  d <- dim(x)
  dim(x) <- c(d[1]*d[2],d[3])
  x[c(lsm)==0,] <- NA
  X <- zoo(t(x),order.by=as.Date(tim + julian(as.Date('1800-1-1'))))
  sst <- as.field(X,lon=lon,lat=lat,param='sst',unit='deg C',
                  longname='Sea surface Temperature',ref='Reynolds OI SST')
  
  ## Estimate annual mean SST:
  SST <- annual(sst)
  SST <- subset(SST,it=c(start(SST),2014))
  save(file='/disk1/SST.rda',SST,sst)