WRFCHEM domain view python
2014-09-04
####WRF_CHEM domain view by python script####
- WRF CHEM domain in nested has to be visualized to correct the nesting and for domain size adjustment. There are few tools available to do that such as dwiz of wrf ems and plotgrid.ncl.
- There is an alternative with python based on this, it is a wrf script tools for visualizing and nesting based simulation. Set of scripts available has a function to visualize the namelist.wps as grid using python matplotlib.
- The
def
function named aswrf_grid_wrapper
is included with wrfutil.py script and it is module like function for pydown.py a main script in pywrf program. In order to use the functionality ofwrf_grid_wrapper
, which rea the namelist.wps and p[lot the grids as per like plotgrid.ncl, the def function and its required functions are copied and pasted in a separate file namedwrf_domain.py
. - In the separate file, following def functions are added
wrf2latlon, read_namelist, set_default_basemap, plot_grid
along with mainwrf_grid_wrapper
function and it was called by adding a linewrf_grid_wrapper()
in the end of script. Some of the auxiliary def functions are copied fromviz/utils.py
file which is imported by the wrfutils.py script. - The running of script requires following libraries to import and faced problem related to that.
- to import
from mpl_toolkits.basemap import Basemap
got error ofusr/lib/pymodules/python2.7/mpl_toolkits/__init__.py:2: UserWarning: Module dap was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path __import__('pkg_resources').declare_namespace(__name__)
this error was solved by editing following file/usr/lib/python2.7/dist-packages/dap-2.2.6.7.egg-info/namespace_packages.txt
and add a linedap
as the first line, based on this - have to import
import numpy as n
- have to import
from matplotlib.numerix import ma
but based on this import was changed intofrom numpy import ma
- have to import
from pyproj import Proj
this module was installed by downloading it source file from here and installed following its readme as bypython setup.py build, sudo python setup.py install
- Some minor edits were made on this and also needed to add more functions into the program from the main program. Finally, the edit fetches to correctness with the plotting of the outer domain in the background map such as
. Having a limitation of viewing only one domain per time.
- to import