Nishadh KA

WRFCHEM domain view python

2014-09-04


####WRF_CHEM domain view by python script####

  1. 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.
  2. 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.
  3. The def function named as wrf_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 of wrf_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 named wrf_domain.py.
  4. In the separate file, following def functions are added wrf2latlon, read_namelist, set_default_basemap, plot_grid along with main wrf_grid_wrapper function and it was called by adding a line wrf_grid_wrapper() in the end of script. Some of the auxiliary def functions are copied from viz/utils.py file which is imported by the wrfutils.py script.
  5. The running of script requires following libraries to import and faced problem related to that.
    1. to import from mpl_toolkits.basemap import Basemap got error of usr/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 line dap as the first line, based on this
    2. have to import import numpy as n
    3. have to import from matplotlib.numerix import ma but based on this import was changed into from numpy import ma
    4. have to import from pyproj import Proj this module was installed by downloading it source file from here and installed following its readme as by python setup.py build, sudo python setup.py install
    5. 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 asthis. Having a limitation of viewing only one domain per time.