Python/pflexpart

From mn/geo/geoit
Revision as of 15:19, 14 October 2011 by Jfb (talk | contribs) (Created page with "=Introduction to Working with pflexpart= Intro text (TBC) Should point to web page help ==Recipes== This is a place for keeping track of the current process for doing various ...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction to Working with pflexpart

Intro text (TBC) Should point to web page help

Recipes

This is a place for keeping track of the current process for doing various things with pflexpart. If you are working through a plotting routine, or otherwise doing some processing with pflexpart, please feel free to contribute some notes here.

Plotting output from a model run for a known time/species/level

H = pf.Header('path/to/output')
# read a grid for a known time / nspec 
# NOTE:these are indexes to H.available_dates and H.species so 1 is not _001
H.read_grid(time_ret=0, nspec_ret=0 )

H.read_grid will create a new object on the Header. This new object ('FD') is a Python dictionary. It is keyed by tuples that represent the species and time for the request. See H.FD.keys() to get an overview of what is available.

The next step is to get the data from the FD (which is Flexpart Data, by the way). Each 'grid' for each species/date pair will have shape (X , Y, Z, nspec) but nspec now is almost always 1, and *not* related to above nspec_ret (sorry, just the way it is -- legacy)

So, we want to get the 'grid' for our request:

grid = H.FD[ (nspec, date) ]['grid']

The next step is to calculate the total column and break the grid into 'slabs' that we want for our analysis:

D = pf.get_grid(H, grid)

Now D is another dictionary. This time keyed by {0 ... N} where N is the number of outheights+1. The D[0] grid will be the Total Column:

tc = D[0]
tc.shape