atmoschem/wrftools

add get_height

ibarraespinosa opened this issue · 1 comments

According to https://www.openwfm.org/wiki/How_to_interpret_WRF_variables, Elevation can be calculated as

The longitude and latitude of the theta and U nodes are given by arrays XLONG and XLAT, which are set at initialization and then do not change. However the elevation has to be computed from the flow solution as geopotential height by

ELEVATION_W(i,j,k) = (PHB(i,j,k) + PH(i,j,k))/9.81
where PHB + PH is the geopotential. PHB is constant, set at initialization, and PH, called perturbation geopotential, starts as zero and varies with time.

PH and PHB live at the W-points, thus the geopotential height at the lowest level is the same as terrain height

ELEVATION_W(i,j) = PHB(i,j,1)/9.81
up to rounding error. This variable is also part of WRF state as z_at_w and its output to wrfout or wrfrst files can be enabled in the registry.

To find the elevation of the cell theta-points (the cell midplane, where the pressure and other variables than wind live), you need to interpolate between the elevation of the top and the bottom:

ELEVATION_THETA(i,j,k) =0.5*(PHB(i,j,k) + PH(i,j,k) + PHB(i,j,k+1) + PH(i,j,k+1))/9.81
This variable is also part of WRF state as Z and its output to wrfout or wrfrst files can be enabled in the registry.

Therefore, ELEVATION can be calculated with a new function get_height

need to add a text file when running wrf.exe indicating to extract the variable HGT