= Scripts for processing WRF and CAMx files to PALM dynamic driver. == Usage The set of Python scripts in directory [source:palm/trunk/UTIL/WRF_interface WRF_interface] serves for processing of WRF and CAMx output files to the PALM dynamic driver. The processing is launched by script python palm_dynamic.py from the subdirectory "dynamic". This script requires name of the configuration on the command line: `palm_dynamic.py -c [-w]` The corresponding configuration files are placed in the subdirectory "configuration" and they are named .conf. Examples of the config files are supplied with the scripts, all configuration options are described in the README file as well as at the end of this page. The values which agree with defaults need not to be present in the user config. The file palm_dynamic_init.py contains setting and calculation of standard initialization values for particular system and can be adjusted. The optional parameter -w allows to skip horizontal and vertical interpolation in case it has been already done in previous run of this script for the same domain and resolution. The scripts were implemented with regards to good portability and they only depend on standard and well-known Python libraries. Needed modules are: - numpy (https://pypi.org/project/numpy) - scipy (https://pypi.org/project/scipy) - pyproj (https://pypi.org/project/pyproj) - netCDF4 (https://pypi.org/project/netCDF4) - metpy (https://unidata.github.io/MetPy) First four modules are included in all major linux distributions. In other cases, they can be installed via pip (e.g. "pip3 install netCDF4"). The !MetPy module is a well-known and widely used module for meteorological calculations in Python maintained by Unidata. It can also be installed using pip ("pip3 install !MetPy"). In the current version, the only supported projection in WRF is Lambert conformal conic, which is WRF default and recommended projection for mid-latitudes. The CAMx output files, which are used optionally for the chemical initial and boundary conditions, are expected to be the result of a coupled CAMx simulation using the same horizontal grid as WRF, although this is not strictly required. The scripts support both variants of WRF vertical levels - the sigma levels (default until WRF version 3.*) and the hybrid levels (default since WRF 4.*). However, it is necessary to correctly configure this option via the setting "wrf_hybrid_levs = !True/False". == Configuration Configuration files have syntax: {{{ # Comment line = = ... }}} Parameters can be string, integer, float, logical or list of these values. The terms have Python syntax, the config file needs to contain only parameters which differ from default. Description of the particular configuration options are: === Domain and case related configurations ||='''Option''' =||='''Default value''' =||='''Description''' =|| |----------- || domain || "" || Name of the simulation case. || || scenario || "" || Name of the scenario in the case. || || resolution || "" || Name of the domain resolution. || || nested_domain || False || False indicates parent and True nested domain. || || dynamic_driver_file || "" || File name of output dynamic driver. The default value "" means the standard name assigned in the palm_dynamic_init. || || grid_from_static || True || True means the horizontal grid parameters are imported from the static driver, in case of False, they are to be prescribed in the config (see below). || || static_driver_file || "" || File name of the static driver in case of grid_from_static = True. The default value "" means the standard name is assigned in init. || || proj_palm || "EPSG:32633" || Reference coordinate system of the PALM simulation. || || proj_wgs84 || "EPSG:4326" || Reference coordinate system of lon-lat projection. || || dz || 0.0 || Height of the PALM vertical grid layer. The default value dz = 0.0 means dz is assigned from dx. || || nz || 200 || Number of vertical layers of PALM domain. || || dz_stretch_level || 5000.0 || Height in meters from which stretching of vertical levels starts in PALM. || || dz_stretch_factor || 1.0 || Coefficient of the stretching of the vertical layers in PALM. || || dz_max || 100.0 || Maximal height of the stretched vertical layers. || || origin_time || "" || Origin time of the PALM simulation in the format YYYY-MM-DD hh:mm:ss. The default value "" means that the value is set from the global attribute "origin_time" of the static driver. || || simulation_hours || 24 || Extent of the simulation in hours. || === WRF and CAMx related configurations ||='''Option''' =||='''Default value''' =||='''Description''' =|| |----------- || wrf_hybrid_levs || True || True means hybrid levels in WRF files, False sigma levels. || || vinterp_terrain_smoothing || None || The standard deviation for Gaussian kernel of smoothing method of the PALM terrain for WRF vertical interpolation to avoid sharp horizontal gradients. Value None disables the smoothing. || || wrf_dir_name || "" || Path of the directory containing the wrf and camx files. The default value "" means that the standard path will be calculated in the init. || || wrf_file_mask || "wrfout_*.e000" || File mask of the wrf input files. || || radiation_from_wrf || True || Enable or disable processing of radiation from WRF files. || || wrf_rad_file_mask || "auxhist6_*" || File mask of the wrf radiation input files. The default setting reads radiation from WRF auxiliary history files. This setting allows to use finer time step for WRF radiation outputs than for other WRF values. || || radiation_smoothing_distance || 10000.0 || Smoothing distance for radiation values in m. || || camx_file_mask || "CAMx.*.nc" || File mask of the CAMx input files. || || species_names || ['NO','NO2','O3','PM10','PM25'] || PALM names of the chemical species. The default value can be used for phstatp and phstatp2 chemical mechanisms in PALM. The mapping and recalculation from the CAMx species to PALM species is defined in the variable camx_conversions (see palm_dynamic_init.py). The default mapping is configured for CAMx v6.50 with CB05 + PM (CF,SOAP2.1,ISORROPIA) chemistry mechanisms. In case of other combinations, it may be necessary to adjust this mapping. || === Horizontal parameters of the PALM domain in case of grid_from_static = False ||='''Option''' =||='''Description''' =|| |----------- || nx, ny || Number of horizontal grids of the domain in x and y directions. || || dx, dy || Grid cell size of the domain in x and y directions. || || origin_x, origin_y || Origin of the domain in the x and y directions. || || origin_z || Origin of the domain in the vertical direction. || == Credits Version: 3.1, License: GPL v3, Authors: Krystof Eben, Jaroslav Resler, Pavel Krc, Institute of Computer Science of the Czech Academy of Sciences, Prague. For an example of utilization see e.g. https://doi.org/10.5194/gmd-2020-175.