Always necessary!
Let us say that you have a namelist.wps like this:
&share
wrf_core = 'ARW',
max_dom = 2,
start_date = '2014-10-03_00:00:00','2014-10-03_00:00:00'
end_date = '2014-10-11_00:00:00','2014-10-11_00:00:00'
interval_seconds = 21600
io_form_geogrid = 2,
/
&geogrid
parent_id = 1, 1,
parent_grid_ratio = 1, 3,
i_parent_start = 1, 35,
j_parent_start = 1, 33,
e_we = 95, 67,
e_sn = 90, 64,
geog_data_res = 'usgs','usgs',
dx = 9000,
dy = 9000,
map_proj = 'lambert',
ref_lat = -23.5,
ref_lon = -46.353519,
truelat1 = -23.5,
truelat2 = -23.5,
stand_lon = -46.353519
geog_data_path = '/PATH/WPS_GEOG'
/
&ungrib
out_format = 'WPS',
prefix = 'FILE',
/
&metgrid
fg_name = 'FILE'
io_form_metgrid = 2,
/
Then you just do
./geogrid.exe
This will generate the files:
now let us plot the domains if they are in the right place!
First let us read the grid from the geo_em.d02.nc file, let us add the coatlines and also another shapefile for reference
library(eixport)
#> The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
#> which was just loaded, will retire in October 2023.
#> Please refer to R-spatial evolution reports for details, especially
#> https://r-spatial.org/r/2023/05/15/evolution4.html.
#> It may be desirable to make the sf package available;
#> package maintainers should consider adding sf to Suggests:.
#> The sp package is now running under evolution status 2
#> (status 2 uses the sf package in place of rgdal)
library(sf)
#> Linking to GEOS 3.11.1, GDAL 3.6.2, PROJ 9.1.1; sf_use_s2() is TRUE
# d02
g <- wrf_grid("/media/sergio/ext5/WRF4/WPS/geo_em.d02.nc", type = "geo")
#> using grid info from: /media/sergio/ext5/WRF4/WPS/geo_em.d02.nc
#> Number of lat points 125
#> Number of lon points 160
plot(g$geometry,axes = T, reset = F, lwd = 0.1)
And then with leaflet would be