Hi r-sig-geo,

previously I used following code to extract time series value for a given
coodinate from a netcdf file:
  require(raster)
  require(ncdf)
  require(sp)
  X1 <- -90.5167
  Y1 <- 33.45
  MS <- cbind(X1,Y1)
  p <- SpatialPoints(MS)
  year <- 1981
  setwd("e:/PRISM/NetCDF/")
  filename <- paste("PRISM_MS")
  pptfile <- paste("ppt","_",year,".nc",sep='')
  b_ppt <- brick(pptfile,varname='ppt')
  ppt <- extract(b_ppt,coordinates(p))

it was successful. However, when I use the same method for another NetCDF
(which has unusual dimension),  i got errors, then I check the difference,
it showed that the dimension for the two files are different:
The file is working has following information:
Netcdf file 1:
class       : RasterBrick
*dimensions  : 621, 1405, 872505, 365  (nrow, ncol, ncell, nlayers)*
resolution  : 0.04166667, 0.04166667  (x, y)
extent      : -125.0208, -66.47917, 24.0625, 49.9375  (xmin, xmax, ymin,
ymax)
coord. ref. : +proj=longlat +datum=NAD83 +no_defs +ellps=GRS80
+towgs84=0,0,0
data source : e:\PRISM\NetCDF\ppt_1981.nc
names       : X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14,
X15, ...
unknown     : 1, 365 (min, max)
varname     : ppt

The one is not working with above code has following information
NetCDF file 2:
class       : RasterBrick
*dimensions  : 1386, 365, 505890, 585  (nrow, ncol, ncell, nlayers) *
resolution  : 1, 0.041666  (x, y)
extent      : 29584.5, 29949.5, -124.793, -67.04392  (xmin, xmax, ymin,
ymax)
coord. ref. : +proj=longlat +datum=WGS84
data source : e:\UoIGriddedWeather\pr_1981.nc
names       : X49.3960227966309, X49.3543586730957, X49.3126907348633,
X49.2710266113281, X49.2293586730957, X49.1876945495605, X49.1460266113281,
X49.104362487793, X49.0626945495605, X49.0210304260254, X48.979362487793,
X48.9376983642578, X48.8960304260254, X48.8543663024902, X48.8126983642578,
...
degrees_north: 25.0630779266357, 49.3960227966309 (min, max)
varname     : precipitation_amount

The dimension in the NetCDF file 2 is not correct. should be 585, 1386,
505890,365.

Has someone encountered the same problem before? How to resolve this?

Look forward suggestions and solutions.

Thanks,

Ping

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to