[R-sig-Geo] display projected NetCDF files

Walt Golet wgolet at gmri.org
Wed Jul 14 19:42:51 CEST 2010


Hello,
A new list member here with a question regarding the display of projected NetCDF files in R.  The initial grids (dimension 349 x 277) cover all of North America with the following borders:
12.2N;133.5W, 54.5N; 152.9W, 57.3N; 49.4W ,14.3N;65.1W in the Lambert Conformal Conic Grid.  I extracted a smaller grid (our area of interest) which becomes a 64 x 51 matrix for air temperature, longitude and latitude with new borders (40.614, -84.052)  (54.263, -76.513) (44.268,-52.644) (32.869,-63.768).  

#####Reading, extracting and sub setting the grid 
library(ncdf) 
  AIR1=open.ncdf("air.mon.mean.nc",write=FALSE,readunlim=TRUE)
      print(AIR1)
        AIR2=AIR1$var[[2]]
            AIR=get.var.ncdf(AIR1,AIR2,start=c(1,1,13,1),count=c(349,277,1,372))    
                   AIR_JAN_1979=AIR[234:297,120:170,1]  
                      AIR2LAT=AIR1$var[[3]]
                        AIR_LAT_19791=get.var.ncdf(AIR1,AIR2LAT,start=c(1,1),count=c(349,277))
                          AIR_LAT_1979=AIR_LAT_19791[234:297,120:170]
                      AIR2LONG=AIR1$var[[4]]
                 AIR_LONG_19791=get.var.ncdf(AIR1,AIR2LONG,start=c(1,1),count=c(349,277))
            AIR_LONG_1979=AIR_LONG_19791[234:297,120:170]  

#######file information on projection and orientation of grid 
int Lambert_Conformal[] "
           grid_mapping_name: lambert_conformal_conic"
          standard_parallel: 50" "            standard_parallel: 50"
           longitude_of_central_meridian: -107"
           latitude_of_projection_origin: 50"
           false_easting: 5632642.22547"
           false_northing: 4612545.65137"
 y  Size:277" #### Original size of grid, extracted one is only 64 x 51
          long_name: northward distance from southwest corner of domain in projection coordinates"
            units: m"
            standard_name: projection_y_coordinate"
       x  Size:349"
            long_name: eastward distance from southwest corner of domain in projection coordinates"
           units: m"
            standard_name: projection_x_coordinate"
        nbnds  Size:2"


simple plots such as filled.contour will plot the results, but are not projected properly.
I imagine there is a method within rgdal{spTransform} to correctly display this data in its projected format or perhaps transform these positions, but it eludes me at this time.  Somewhat similar questions have appeared online, but the answers I have found do not give correct projections.  Any help with this would be appreciated.  Thanks in advance for what may be a simple transformation,

Walt   



More information about the R-sig-Geo mailing list