[R-sig-Geo] Set up raster data in WRF Mercator projection

David Wang dw2116 at outlook.com
Wed Aug 3 17:46:12 CEST 2016


Hello,


I'd like to load a WRF (Weather Research and Forecasting) output file in NetCDF as rasters and set up correct projection and coordinates. Using land mask as an example,


landmask <- raster("geo_em_d01.nc", varname = "LANDMASK")


The projection of this particular WRF simulation is Mercator. After extensive googling, I came up with this projection string:


projection(landmask) <- CRS("+proj=merc +lat_ts=30 +lon_0=-67 +a=6370000.0 +b=6370000.0 +units=km +no_defs")


That is based on the grid information from ncdump -h geo_em_d01.nc:


                :GRIDTYPE = "C" ;
                :DX = 27000.f ;
                :DY = 27000.f ;
                :DYN_OPT = 2 ;
                :CEN_LAT = 32.f ;
                :CEN_LON = -67.f ;
                :TRUELAT1 = 30.f ;
                :TRUELAT2 = 45.f ;
                :MOAD_CEN_LAT = 32.f ;
                :STAND_LON = 290.f ;
                :POLE_LAT = 90.f ;
                :POLE_LON = 0.f ;
                :corner_lats = 6.033165f, 52.29568f, 52.29568f, 6.033165f, 6.033165f, 52.29568f, 52.29568f, 6.033165f, 5.893715f, 52.38135f, 52.38135f, 5.893715f, 5.893715f, 52.38135f, 52.38135f, 5.893715f ;
                :corner_lons = -129.8151f, -129.8151f, -4.184856f, -4.184856f, -129.9554f, -129.9554f, -4.044647f, -4.044647f, -129.8151f, -129.8151f, -4.184856f, -4.184856f, -129.9554f, -129.9554f, -4.044647f, -4.044647f ;
                :MAP_PROJ = 3 ;

However, I'm not entirely sure this projection is correct. Furthermore, I have no clue how to set extent(landmask) in km. Can anyone familiar with WRF give me a pointer or two?


Thanks,

David

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list