I've been a WRF user for almost 5 years now, and contributed code to a recent public release. I am not aware that WPS (WRF Preprocessing System) has such a tool that takes in the grid and point coordinates and returns the appropriate index. However, it is very straightforward to do so yourself. Some suggest using an external library, I think that may be an overkill for such a simple task. Here is what you need to do:
1) Rungeogrid.exeto generate the parent grid. Since you don't know the exact location of the nest yet, setmax_dom = 1innamelist.wps. This will generate a file calledgeo_em.d01.nc.
2) Look at thegeo_em.d01.ncfile to find the right indices for your child domain.i_parent_startandj_parent_startrefer to the x and y indices on the parent grid at which the southwest corner of the child grid will be positioned.XLONG_MandXLAT_Mare the longitude and latitude grids of the mass (pressure) points. Using a programming language of choice, find the grid cell that is closest to your desired location for the child nest corner. This is typically done by looking for the minimum value of distance between desired location and all the points on the grid. For example, in Fortran, you can do something like:
integer :: i_parent_start,j_parent_start integer,dimension(2) :: coords coords = minloc((lon0-xlong_m)**2+(lat0-xlat_m)**2) i_parent_start = coords(1) j_parent_start = coords(2)
wherexlong_mandxlat_mare 2-dimensional arrays that you read from the grid, andlat0andlon0are the desired coordinates of the child nest southwest corner. Similarly, if you use Python, you could do:
import numpy as np j_parent_start,i_parent_start = np.unravel_index(\ np.argmin((lon0-xlong_m)**2+(lat0-xlat_m)**2),xlon_m.shape) # Add one because WRF indices start from 1 i_parent_start += 1 j_parent_start += 1
3) Now editnamelist.wpsagain, set thei_parent_startandj_parent_startto the values that you calculated in step 3, setmax_dom = 2, and re-rungeogrid.exe. The child domain filegeo_em.d02.ncshould be created.
4) Look at thegeo_em.d02.ncfile. Repeat the procedure until happy with the domain location.
About theparent_grid_ratioparameter. This is an integer factor of child grid refinement relative to the parent grid. For example, if set to 3, and parent grid resolution is 12 km, the child grid resolution will be 4 km. Odd values forparent_grid_ratio(3, 5, etc.) are recommended because for even values, interpolation errors arise due to the nature of Arakawa C-grid staggering.parent_grid_ratio = 3is the most commonly used value, and recommended by myself.