3

I have a huge problem and I can not find a reason for it. I have two PCa, one in my house and the other in my workplace. The first one is an old notebook with Windows x86 and the other is Windows x64. I work in R in geospacial topics, and I have huge difference between the two system. The idea of my work is get the pixels of a raster (NetCDF) inside of a boundary of my whateshed (vector), so the code that I used is something like this:

 ncin <- nc_open(ncfname) #open the ncdf file
 #extract the variable 'precipitation' and latitud and longitud     
 pp<-ncvar_get(ncin, varid = 'pr', start = c(1,1,1), count = c(-1,-1,1))
 lat <- ncin$dim$lat$vals   # latitude position
 lon <- ncin$dim$lon$vals  # longitude position
 # create a raster from ncin and transpose and flip the raster and extent 
 r <- raster(pp, crs ="+init=epsg:4326" )
 rt <- t(r)
 rt <- flip(rt,direction=2)
 extent(rt)<-extent(c(range(lon), range(lat)))
 #open the shapefile or boundary (watershed), the shapefile is in CRS:4326
 myShape<-readOGR(dsn = myShapefileDir, layer = myShapefile)
 #crop the raster with the boundary
 crop = crop(x=rt,y = myShape, snap='in')

Then I have like the raster map is slipped in Windows x86 in comparison with Windows x64, you can look the difference in the next image (The left plot is created in Wx86 and the right in Wx64:

explain

I know that right image is from GRASS GIS, but happens the same in R or GRASS GIS.

The correct image is the right, but I cant get the same results in Windows x86.

The netcdf file can download here at the end (it is call 'CR2MET_v1.4.2_pr_day_1979_2016') :

http://www.cr2.cl/datos-productos-grillados/?cp_cr2met=3

The boundary or shapefile can download from here (google drive, it is call 'polygon'):

https://drive.google.com/open?id=1N0w-mCYkPPk_kayTKnbkMJ8f3jsS4PuB

  • you're absolutely sure the netcdf is in epsg:4326? As the R code does not transform it (only renames it), and if it is in something slightly different, it will plot differently. – Sam Feb 4 at 9:30
  • Hello Sam, the netcdf does not specify the epsg, but is the standard for latitute and longitude, so i assume that. the metadata of netcdf doesnt say anything, how can i know the epsg code? – Pablo Sanhueza Feb 5 at 3:46
  • The netcdf said : CDI: Climate Data Interface version 1.9.0 (mpimet.mpg.de/cdi and Conventions: CF-1.6 – Pablo Sanhueza Feb 5 at 3:58
  • yes it will be EPSG:4326 then. That is standard WGS84 lat long. Without access to the netcdf and polygon, it's hard to help – Sam Feb 5 at 8:50
  • i add the links in the OP! – Pablo Sanhueza Feb 7 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.