/pynameplot

Read, analyse and plot results of Met Office Numerical Atmospheric-dispersion Modelling Environment (NAME) dispersion models.

Primary LanguagePythonOtherNOASSERTION

NAME file analysis and plotting software

(c)2017 J. Duncan Law-Green, Kyubi Systems

+++ SET UP ENVIRONMENT:

To set up the correct Python environment to run the NAME scripts

source ./setup.sh

The prompt will change to include '(venv.geo)'.

+++ SOFTWARE:

There are three main pieces of software available for NAME processing and analysis:

  • makemastergrid.py - given a list of ESRI shapefiles and an example NAME file, will computer a 'master grid file' listing covering factors for each square in the input NAME grid.

  • zonecsv.py - given a master grid file and a NAME file, or a directory containing NAME files, will calculate summed particle concentrations by zone, outputting a CSV file, one row per timestamp in the input name file(s).

  • plotter.py - given a configuration file, will plot an input NAME file (or a sum of multiple NAME files) on a map.

+++ COMMAND-LINE HELP:

Each software script has a simple help function which displays the options available on the command line, accessible by appending '-h' or '--help' to the script name, e.g.

./makemastergrid.py --help

+++ SHAPEFILE LIST:

In order to build a master grid file, the first step is to compile an input list of the input ESRI shapefiles used to denote the zones required. The shapefile list is a simple ASCII CSV file, with one row per ESRI zone, in the following format

/data/name/Python/Final_PML_shapefiles_04_05_17_new/Africa.shp, Tomato

The first element is the full path to the ESRI '.shp' shapefile, the second is the HTML colour desired for that zone on map plots.

A text file listing all .shp shapefiles in a given directory can be generated by the simple command:

ls /data/name/Python/Final_PML_shapefiles_04_05_17_new/*.shp > PML_shapefiles.example

+++ MAKEMASTERGRID

usage: makemastergrid [-h] -n NAMEFILE -s SHAPELIST -o OUTFILE

Generate master grid file from ESRI zones.

optional arguments: -h, --help show this help message and exit -n NAMEFILE, --namefile NAMEFILE Input NAME file to define grid shape -s SHAPELIST, --shapelist SHAPELIST File containing list of input shapefiles -o OUTFILE, --outfile OUTFILE Output master grid file name

+++ ZONECSV

usage: zonecsv [-h] (-d INDIR | -n NAMEFILE) -g GRID -o OUTFILE [-w WEEK | -m MONTH | -y YEAR]

Sum NAME concentration files over ESRI zones.

optional arguments: -h, --help show this help message and exit -d INDIR, --indir INDIR Input NAME file directory -n NAMEFILE, --namefile NAMEFILE Input NAME file to sum over -g GRID, --grid GRID Input master grid file -o OUTFILE, --outfile OUTFILE Output CSV results file -w WEEK, --week WEEK Select NAME files from ISO week number -m MONTH, --month MONTH Select NAME files from Month number -y YEAR, --year YEAR Select NAME files from Year