In [1]:
from notebook.services.config import ConfigManager
cfm = ConfigManager()
cfm.update('livereveal', {
              'theme': 'simple',
              'transition': 'convex',
              'start_slideshow_at': 'selected'
})


Out[1]:
{'start_slideshow_at': 'selected', 'theme': 'simple', 'transition': 'convex'}

Python Analysis Figures

Author: Barron H. Henderson


In [2]:
# Prepare my slides
%pylab inline
%cd working


Populating the interactive namespace from numpy and matplotlib
/Users/barronh/Downloads/GCandPython/working

Data for Figures

In this exercise, we will use publicly available data to create some pretty plots that combine GEOS-Chem results with observations from the DC8 aircraft on the DC3 campaign.

In a minute, not yet, we are going to download the data.

Downloads DC3 Observations

Download Merged Observations from DC8 aircraft during the DC3 campaign.


In [3]:
%mkdir icartt
!curl -Lo icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict http://www-air.larc.nasa.gov/cgi-bin/enzFile?e38EE03EFAE02C04F06E9647DAF98F48D6A2f7075622d6169722f534541433452532d4443332f4d45524745532f315f4d494e5554452e4443385f4d52472f6463332d6d726736302d6463385f6d657267655f32303132303531385f52375f7468727532303132303632322e696374


mkdir: cannot create directory ‘icartt’: File exists
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 30.5M  100 30.5M    0     0  1227k      0  0:00:25  0:00:25 --:--:-- 1327k

Download GEOS-Chem Benchmark

Benchmark data is available from Harvard's website as below

!curl -LO ftp.as.harvard.edu/gcgrid/geos-chem/1yr_benchmarks/v10-01/v10-01-public-release/Run0/tracerinfo.dat
!curl -LO ftp.as.harvard.edu/gcgrid/geos-chem/1yr_benchmarks/v10-01/v10-01-public-release/Run0/diaginfo.dat
!curl -LO ftp.as.harvard.edu/gcgrid/geos-chem/1yr_benchmarks/v10-01/v10-01-public-release/Run0/bpch.tar.gz

Smaller, Faster Downloads


In [4]:
!curl -LO ftp.as.harvard.edu/gcgrid/geos-chem/1yr_benchmarks/v10-01/v10-01-public-release/Run0/tracerinfo.dat
!curl -LO ftp.as.harvard.edu/gcgrid/geos-chem/1yr_benchmarks/v10-01/v10-01-public-release/Run0/diaginfo.dat


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 83324  100 83324    0     0  47062      0  0:00:01  0:00:01 --:--:-- 47102
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13840  100 13840    0     0   8686      0  0:00:01  0:00:01 --:--:--  8704
!curl -LO ftp://data.as.essie.ufl.edu/pub/exch/GCandPython/working/bpch.zip

In [5]:
import zipfile
zf = zipfile.ZipFile('bpch.zip')
zf.extract('bpch/ctm.bpch.v10-01-public-Run0.2013050100')


Out[5]:
'/Users/barronh/Downloads/GCandPython/working/bpch/ctm.bpch.v10-01-public-Run0.2013050100'

Unzip june too.

CHECK POINT:

List the size of of the file you downloaded

ANSWERS Hidden

ls -lh ls -lh icartt ``` 296M bpch/ctm.bpch.v10-01-public-Run0.2013050100 296M bpch/ctm.bpch.v10-01-public-Run0.2013060100 31M icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict ```

Intro to the Common Data Model

  1. files and groups
  2. dimensions
  3. properties
  4. variables
  5. Conventions
    • IOAPI and WRF-IOAPI
    • COARDS
    • Climate Forecasting (CF) Conventions
  6. Conceptualizing any data set as CDM

pncdump returns the common data language

--header : don't show data
-f ffi1001 : format is NASA AMES ffi1001
-v VAR1,VAR2,...,VARN : only show these variables

For archiving, I am only dumping 3 variables. Try omitting -v


In [6]:
!pncdump.py --header -v Fractional_Day,UTC,O3_ESRL -f ffi1001 icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict


PseudoNetCDF.core._files.PseudoNetCDFFile icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict {
dimensions:
        POINTS = 6817 ;

variables:
        double Fractional_Day(POINTS);
                Fractional_Day:units = "Fractional_Day, none" ;
                Fractional_Day:fill_value = -999999.0 ;
                Fractional_Day:llod_value = "N/A" ;
                Fractional_Day:scale = 1.0 ;
                Fractional_Day:llod_flag = -888888 ;
                Fractional_Day:standard_name = "Fractional_Day" ;
                Fractional_Day:ulod_flag = -777777 ;
                Fractional_Day:missing_value = -999999 ;
                Fractional_Day:ulod_value = "N/A" ;
        double O3_ESRL(POINTS);
                O3_ESRL:units = "ppbv" ;
                O3_ESRL:fill_value = -999999.0 ;
                O3_ESRL:llod_value = "N/A" ;
                O3_ESRL:scale = 1 ;
                O3_ESRL:llod_flag = -888888 ;
                O3_ESRL:standard_name = "O3_ESRL" ;
                O3_ESRL:ulod_flag = -777777 ;
                O3_ESRL:missing_value = -999999 ;
                O3_ESRL:ulod_value = "N/A" ;
        double UTC(POINTS);
                UTC:units = "s" ;
                UTC:fill_value = -999999.0 ;
                UTC:llod_value = "N/A" ;
                UTC:scale = 1 ;
                UTC:llod_flag = -888888 ;
                UTC:standard_name = "UTC" ;
                UTC:ulod_flag = -777777 ;
                UTC:missing_value = -999999 ;
                UTC:ulod_value = "N/A" ;


// global properties:
                :fmt = "1001" ;
                :n_header_lines = 409 ;
                :PI_NAME = "Shook, Michael" ;
                :ORGANIZATION_NAME = "NASA Atmospheric Composition Branch, NASA Langley Research Center (SSAI)" ;
                :SOURCE_DESCRIPTION = "Merged data file for DC3, Flights 01-18 (20120518-20120622), on the DC-8 platform. Data is merged to 60 seconds/timeline." ;
                :MISSION_NAME = "NSF DC3 Mission 2012" ;
                :VOLUME_INFO = "1, 1" ;
                :SDATE = "20120518" ;
                :WDATE = "20160113" ;
                :TIME_INTERVAL = "-1" ;
                :INDEPENDENT_VARIABLE = "Fractional_Day, none" ;
                :PI_CONTACT_INFO = "michael.shook@nasa.gov,jennifer.r.olson@nasa.gov,gao.chen@nasa.gov" ;
                :PLATFORM = "NASA Dryden DC-8 Aircraft" ;
                :LOCATION = "Latitude, Longitude, and Altitude included in data records" ;
                :ASSOCIATED_DATA = "N/A" ;
                :INSTRUMENT_INFO = "N/A" ;
                :DATA_INFO = "Please see PI data file for explanation of ULOD and LLOD." ;
                :UNCERTAINTY = "See individual files for uncertainty information." ;
                :ULOD_FLAG = "-777777" ;
                :ULOD_VALUE = "N/A" ;
                :LLOD_FLAG = "-888888" ;
                :LLOD_VALUE = "N/A" ;
                :DM_CONTACT_INFO = "gao.chen@nasa.gov" ;
                :PROJECT_INFO = "N/A" ;
                :STIPULATIONS_ON_USE = "N/A" ;
                :OTHER_COMMENTS = "This merge was created using data in the NASA DC3 archive" ;
                :as of 01/12/2016. = "as of 01/12/2016." ;
                :In most cases, variable names have been kept identical = "In most cases, variable names have been kept identical" ;
                :to those submitted in the raw data files. = "to those submitted in the raw data files." ;
                :However, in some cases, names have been changed = "However, in some cases, names have been changed" ;
                :(e.g., to eliminate duplication) = "(e.g., to eliminate duplication)" ;
                :Units have been standardized throughout the merge. = "Units have been standardized throughout the merge." ;
                :Contact michael.shook@nasa.gov with any questions as to which data was included. = "Contact michael.shook@nasa.gov with any questions as to which data was included." ;
                :REVISION = "R7" ;
                :R7 = "Includes data submitted as of 01/12/2016. See the readme file for a more detailed changelog." ;
                :R6 = "Includes data submitted as of 05/19/2015." ;
                :R5 = "Includes data submitted as of 06/09/2014." ;
                :R4 = "Includes data submitted as of 03/03/2014." ;
                :R3 = "Includes data submitted as of 11/26/2013." ;
                :R2 = "Includes data submitted as of 11/25/2013." ;
                :R1 = "Includes data submitted as of 03/26/2013." ;
                :R0 = "Includes data submitted as of 02/05/2013." ;
                :TFLAG = "Fractional_Day" ;
                :history = "/Users/barronh/Development/pseudonetcdf/scripts/pncdump.py --header -v Fractional_Day,UTC,O3_ESRL -f ffi1001 icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict;/Users/barronh/Development/pseudonetcdf/scripts/pncdump.py --header -v Fractional_Day,UTC,O3_ESRL -f ffi1001 icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict;" ;
}

CHECK POINT

  1. List three attributes the IAS variable have (hint: use -v IAS)?

    -

  2. What are IAS units?

    -

  3. What attributes does the file have?

    -


In [ ]:

Common Processing and Terminology

This section will explain many of the techniques used in the tile plot section and in all subsequent sections.

  1. slicing in numpy
  2. dimensional reductions
  3. Loading data from different formats
    • CMAQ (already done)
    • CAMx, WRF, GEOS-Chem, CSV, NASA AMES, AQS
  4. Adding coordinate variables
  5. Using named dimensions via PseudoNetCDF
  6. Adding derived variables via PseudoNetCDF

Time series

Make time series plots with 3 different methods from CMAQ data.

  1. Python Environment
  2. Python with PseudoNetCDF
  3. Command Line Interface (terminal or DOS)
  4. Advanced users will add observations
  5. Advanced users will add another species on a secondary axis
  6. Advanced users will repeat with CAMx or GEOS-Chem

Python Environment

  1. Start easy with a 2-d line plot
  2. Add real data
  3. Transform data to time.

In [7]:
close()
plot([0,10], [0,10], linestyle = '-', color = 'g', label = '1:1')
plot([0,5], [0,10], linestyle = '-', color = 'r', label = '2:1')
plot([0,10], [0,5], linestyle = '-', color = 'b', label = '1:2')
legend()
#savefig('temp.png')


Out[7]:
<matplotlib.legend.Legend at 0x10f14cc88>

In [ ]:

Python with real data


In [8]:
from PseudoNetCDF import PNC
args = PNC('--format=ffi1001', \
           'icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict')
infile = args.ifiles[0]
fdays = infile.variables['Fractional_Day']
o3 = infile.variables['O3_ESRL']
close()
plot(fdays, o3)
xlabel('Fractional Day')
ylabel('Ozone ' + o3.units)
?tick_params


Python with date


In [9]:
import datetime
from PseudoNetCDF import PNC
args = PNC('--format=ffi1001', 'icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict')
infile = args.ifiles[0]
fdays = infile.variables['Fractional_Day']
o3 = infile.variables['O3_ESRL']
offset = datetime.datetime(2011, 12, 31).timestamp()
xdate = [datetime.datetime.utcfromtimestamp(offset + fday * 24*3600) \
         for fday in fdays]
plot(xdate, o3);


Python with pretty date


In [10]:
import datetime
from PseudoNetCDF import PNC
args = PNC('--format=ffi1001', 'icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict')
infile = args.ifiles[0]
fdays = infile.variables['Fractional_Day']
o3 = infile.variables['O3_ESRL']
offset = datetime.datetime(2011, 12, 31).timestamp()
xdate = [datetime.datetime.utcfromtimestamp(offset + fday * 24*3600) \
         for fday in fdays]
figure(figsize = (16, 4))
tick_params(axis = 'both', labelsize = 20, )
plot(xdate, o3)
ax = plt.gca()
ax.xaxis.set_major_formatter(plt.matplotlib.dates.DateFormatter('%m/%d'))
ax.xaxis.set_major_locator(plt.matplotlib.dates.DayLocator(\
                                    bymonthday = [1, 5, 10, 15, 20, 25]))
plt.setp(ax.get_xticklabels(), rotation = 45);


Timeseries using PNC

Your goal: Make a time series plot like the one above using the command line.


In [11]:
!pncts.py \
    --matplotlibrc="figure.figsize=16,6"\
    --format=ffi1001 -v O3_ESRL --coordkeys Fractional_Day \
    --expr "time=Fractional_Day" \
    --expr "time.units='days since 2011-12-31'"\
    icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict dc3ts


**PNC://anaconda/lib/python3.5/site-packages/matplotlib/axes/_axes.py:519:UserWarning:
  No labelled objects found. Use label='...' kwarg on individual plots.
dc3tsO3_ESRL.png

In [12]:
%ls dc3ts*


dc3tsO3_ESRL.png

Scatter Plots

  1. Python Environment (replace plot with scatter, utc with some other variable)
  2. Python with PseudoNetCDF
  3. Command Line Interface (terminal or DOS) (replace pncts.py with pncscatter.py)
  4. Advanced users will switch from time/space paired to rank paired

Tile Plots

Make tile plots of ozone with 3 different methods from CMAQ data.

  1. Python Environment
  2. Python with PseudoNetCDF
  3. Command Line Interface (terminal or DOS)
  4. Advanced users will overlay observations
  5. Advanced users will repeat with CAMx or GEOS-Chem

Python only


In [13]:
from PseudoNetCDF import PNC
args = PNC("--format=bpch,vertgrid='GEOS-5-NATIVE',nogroup=('IJ-AVG-$',)",
           "bpch/ctm.bpch.v10-01-public-Run0.2013050100")
infile = args.ifiles[0]
latb = infile.variables['latitude_bounds']
lonb = infile.variables['longitude_bounds']
ozone = infile.variables['O3'][:, 0].mean(0)

In [14]:
lone = np.append(lonb[0,0], lonb[:, 1])
late = np.append(latb[0,0], latb[:, 1])
LON, LAT = np.meshgrid(lone, late)

In [15]:
close()
pcolor(LON, LAT, ozone, vmin = 20, vmax = 65)
colorbar();


With PNC Mapping


In [16]:
from PseudoNetCDF.coordutil import getmap
m = getmap(infile, resolution = 'c')

In [17]:
rcParams['font.size'] = 18
close()
m.pcolor(LON, LAT, ozone, vmin = 20, vmax = 65)
m.drawcoastlines()
m.drawcountries()
m.drawstates() # What options does this take?
cb = plt.colorbar(orientation = 'horizontal', label = 'O$_3$ ppb')


CLI PseudoNetCDF


In [18]:
!pncmap.py -v O3 -f "bpch,nogroup=('IJ-AVG-$',)" \
-s layer72,0 -r time,mean --norm="Normalize(vmin=0,vmax=80)" \
bpch/ctm.bpch.v10-01-public-Run0.2013050100 srfmap
%ls srfmap*


**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/geoschemfiles/_bpch.py:866:UserWarning:
  vertgrid selected (GEOS-5-REDUCED) and output layers are not consistent; update to GEOS-5-NATIVE (e.g., bpch(..., vertgrid='GEOS-5-NATIVE') -f "bpch,vertgrid='GEOS-5-NATIVE'"
srfmapO3.png

Overlay Observations and Model

Find the range of space and time covered by the observations.

This is our first look at observations from the Common Data Model perspective. Remember: dimensions, properties, and variables (which have dimensions and properties).

Make a map with just GEOS-Chem

pncmap.py is the primary map maker. Like all other pnc commands, it uses options that can be reviewed with --help. It shares all the same slicing, aggregating functions, but it also has a few options that are not included else where.

$ pncmap.py --help

Review the following options

  • --matplotlibrc
  • --figure-keywords
  • --axes-keywords
  • --plot-commands
  • --figformat
  • --norm
  • --colorbar-formatter
  • --overlay
  • --resolution
  • --no-countries, --states, --counties
  • --shapefile
  • --no-squeeze
  • --iter

Start by plotting the whole world for ozone at the 500 hPa

What layer is approximately 500 hPa?


In [19]:
!pncdump.py -v etam_pressure --full-indices c -f bpch bpch/ctm.bpch.v10-01-public-Run0.2013050100


**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/geoschemfiles/_bpch.py:866:UserWarning:
  vertgrid selected (GEOS-5-REDUCED) and output layers are not consistent; update to GEOS-5-NATIVE (e.g., bpch(..., vertgrid='GEOS-5-NATIVE') -f "bpch,vertgrid='GEOS-5-NATIVE'"
PseudoNetCDF.core._files.PseudoNetCDFFile bpch/ctm.bpch.v10-01-public-Run0.2013050100 {
dimensions:
        layer = 47 ;
        layer_bounds = 48 ;
        longitude = 72 ;
        latitude = 46 ;
        time = UNLIMITED // (1 currently) 
        nv = 2 ;
        tnv = 2 ;

variables:
        double etam_pressure(layer);
                etam_pressure:units = "hPa" ;
                etam_pressure:standard_name = "atmosphere_hybrid_sigma_pressure_coordinate" ;
                etam_pressure:base_units = "hPa" ;
                etam_pressure:var_desc = "etam_pressure" ;
                etam_pressure:long_name = "etam_pressure" ;
        float layer_bounds(layer_bounds);
                layer_bounds:units = "level" ;
                layer_bounds:standard_name = "hybrid_sigma_pressure" ;
                layer_bounds:positive = "up" ;
                layer_bounds:long_name = "hybrid level at layer midpoints" ;
        double longitude(longitude);
                longitude:units = "degrees_east" ;
                longitude:axis = "X" ;
                longitude:standard_name = "longitude" ;
                longitude:base_units = "degrees_east" ;
                longitude:bounds = "longitude_bounds" ;
                longitude:long_name = "longitude" ;
        double etai_pressure(layer_bounds);
                etai_pressure:units = "hPa" ;
                etai_pressure:standard_name = "atmosphere_hybrid_sigma_pressure_coordinate" ;
                etai_pressure:base_units = "hPa" ;
                etai_pressure:var_desc = "etai_pressure" ;
                etai_pressure:long_name = "etai_pressure" ;
        float layer(layer);
                layer:units = "level" ;
                layer:standard_name = "hybrid_sigma_pressure" ;
                layer:positive = "up" ;
                layer:long_name = "hybrid level at layer midpoints" ;
        double latitude(latitude);
                latitude:units = "degrees_north" ;
                latitude:axis = "Y" ;
                latitude:standard_name = "latitude" ;
                latitude:base_units = "degrees_north" ;
                latitude:bounds = "latitude_bounds" ;
                latitude:long_name = "latitude" ;
        double time(time);
                time:units = "hours since 1985-01-01 00:00:00 UTC" ;
                time:standard_name = "time" ;
                time:base_units = "hours since 1985-01-01 00:00:00 UTC" ;
                time:bounds = "time_bounds" ;
                time:var_desc = "time" ;
                time:long_name = "time" ;
        double longitude_bounds(longitude, nv);
                longitude_bounds:units = "degrees_east" ;
                longitude_bounds:axis = "X" ;
                longitude_bounds:standard_name = "longitude" ;
                longitude_bounds:base_units = "degrees_east" ;
                longitude_bounds:long_name = "longitude" ;
        double latitude_bounds(latitude, nv);
                latitude_bounds:units = "degrees_north" ;
                latitude_bounds:axis = "Y" ;
                latitude_bounds:standard_name = "latitude" ;
                latitude_bounds:base_units = "degrees_north" ;
                latitude_bounds:long_name = "latitude" ;
        double time_bounds(time, tnv);
                time_bounds:units = "hours since 1985-01-01 00:00:00 UTC" ;
                time_bounds:standard_name = "time_bounds" ;
                time_bounds:base_units = "hours since 1985-01-01 00:00:00 UTC" ;
                time_bounds:var_desc = "time_bounds" ;
                time_bounds:long_name = "time_bounds" ;


// global properties:
                :noscale = False ;
                :nogroup = False ;
                :ftype = b"CTM bin 02                              " ;
                :toptitle = b"GEOS-CHEM binary punch file v. 2.0                                              " ;
                :modelname = b"GEOSFP              " ;
                :modelres = array([ 5.,  4.], dtype=float32) ;
                :halfpolar = 1 ;
                :center180 = 1 ;
                :start_tau0 = 248328.0 ;
                :start_tau1 = 249072.0 ;
                :vertgrid = "GEOS-5-REDUCED" ;
                :Ap = array([  0.00000000e+00,   4.80482600e-02,   6.59375200e+00,
         1.31348000e+01,   1.96131100e+01,   2.60920100e+01,
         3.25708100e+01,   3.89820100e+01,   4.53390100e+01,
         5.16961100e+01,   5.80532100e+01,   6.43626400e+01,
         7.06219800e+01,   7.88342200e+01,   8.90999200e+01,
         9.93652100e+01,   1.09181700e+02,   1.18958600e+02,
         1.28695900e+02,   1.42910000e+02,   1.56260000e+02,
         1.69609000e+02,   1.81619000e+02,   1.93097000e+02,
         2.03259000e+02,   2.12150000e+02,   2.18776000e+02,
         2.23898000e+02,   2.24363000e+02,   2.16865000e+02,
         2.01192000e+02,   1.76930000e+02,   1.50393000e+02,
         1.27837000e+02,   1.08663000e+02,   9.23657200e+01,
         7.85123100e+01,   5.63879100e+01,   4.01754100e+01,
         2.83678100e+01,   1.97916000e+01,   9.29294200e+00,
         4.07657100e+00,   1.65079000e+00,   6.16779100e-01,
         2.11349000e-01,   6.60000100e-02,   1.00000000e-02]) ;
                :Bp = array([  1.00000000e+00,   9.84952000e-01,   9.63406000e-01,
         9.41865000e-01,   9.20387000e-01,   8.98908000e-01,
         8.77429000e-01,   8.56018000e-01,   8.34660900e-01,
         8.13303900e-01,   7.91946900e-01,   7.70637500e-01,
         7.49378200e-01,   7.21166000e-01,   6.85899900e-01,
         6.50634900e-01,   6.15818400e-01,   5.81041500e-01,
         5.46304200e-01,   4.94590200e-01,   4.43740200e-01,
         3.92891100e-01,   3.43381100e-01,   2.94403100e-01,
         2.46741100e-01,   2.00350100e-01,   1.56224100e-01,
         1.13602100e-01,   6.37200600e-02,   2.80100400e-02,
         6.96002500e-03,   8.17541300e-09,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
         0.00000000e+00,   0.00000000e+00,   0.00000000e+00]) ;
                :Conventions = "CF-1.6" ;
                :history = "/Users/barronh/Development/pseudonetcdf/scripts/pncdump.py -v etam_pressure --full-indices c -f bpch bpch/ctm.bpch.v10-01-public-Run0.2013050100;/Users/barronh/Development/pseudonetcdf/scripts/pncdump.py -v etam_pressure --full-indices c -f bpch bpch/ctm.bpch.v10-01-public-Run0.2013050100;" ;


data:
 etam_pressure =
  1005.65033113, // etam_pressure(0,) 
  990.40777188, // etam_pressure(1,) 
  975.1221963749999, // etam_pressure(2,) 
  959.8373744999999, // etam_pressure(3,) 
  944.5528893749999, // etam_pressure(4,) 
  929.268142625, // etam_pressure(5,) 
  913.9839963750001, // etam_pressure(6,) 
  898.7007077125, // etam_pressure(7,) 
  883.4177268, // etam_pressure(8,) 
  868.1348465499999, // etam_pressure(9,) 
  852.85224665, // etam_pressure(10,) 
  837.5702640125, // etam_pressure(11,) 
  819.742555325, // etam_pressure(12,) 
  796.8218315875001, // etam_pressure(13,) 
  771.3545080499999, // etam_pressure(14,) 
  745.8903581125001, // etam_pressure(15,) 
  720.4292968375, // etam_pressure(16,) 
  694.9687652625, // etam_pressure(17,) 
  663.1460754, // etam_pressure(18,) 
  624.9666388999999, // etam_pressure(19,) 
  586.7928323625, // etam_pressure(20,) 
  548.6279033249999, // etam_pressure(21,) 
  510.475420325, // etam_pressure(22,) 
  472.335180325, // etam_pressure(23,) 
  434.2120792, // etam_pressure(24,) 
  396.112404075, // etam_pressure(25,) 
  358.037698575, // etam_pressure(26,) 
  313.96633931, // etam_pressure(27,) 
  267.0867619125, // etam_pressure(28,) 
  226.745209180625, // etam_pressure(29,) 
  192.5871268074936, // etam_pressure(30,) 
  163.6615041418686, // etam_pressure(31,) 
  139.115, // etam_pressure(32,) 
  118.25, // etam_pressure(33,) 
  100.51436, // etam_pressure(34,) 
  85.439015, // etam_pressure(35,) 
  67.45011, // etam_pressure(36,) 
  48.28166, // etam_pressure(37,) 
  34.27161, // etam_pressure(38,) 
  24.079705, // etam_pressure(39,) 
  14.542271, // etam_pressure(40,) 
  6.684756500000001, // etam_pressure(41,) 
  2.8636805, // etam_pressure(42,) 
  1.13378455, // etam_pressure(43,) 
  0.41406405, // etam_pressure(44,) 
  0.138674505, // etam_pressure(45,) 
  0.038000005; // etam_pressure(46,) 
 layer_bounds =
  0, // layer_bounds(0,) 
  1, // layer_bounds(1,) 
  2, // layer_bounds(2,) 
  3, // layer_bounds(3,) 
  4, // layer_bounds(4,) 
  5, // layer_bounds(5,) 
  6, // layer_bounds(6,) 
  7, // layer_bounds(7,) 
  8, // layer_bounds(8,) 
  9, // layer_bounds(9,) 
  10, // layer_bounds(10,) 
  11, // layer_bounds(11,) 
  12, // layer_bounds(12,) 
  13, // layer_bounds(13,) 
  14, // layer_bounds(14,) 
  15, // layer_bounds(15,) 
  16, // layer_bounds(16,) 
  17, // layer_bounds(17,) 
  18, // layer_bounds(18,) 
  19, // layer_bounds(19,) 
  20, // layer_bounds(20,) 
  21, // layer_bounds(21,) 
  22, // layer_bounds(22,) 
  23, // layer_bounds(23,) 
  24, // layer_bounds(24,) 
  25, // layer_bounds(25,) 
  26, // layer_bounds(26,) 
  27, // layer_bounds(27,) 
  28, // layer_bounds(28,) 
  29, // layer_bounds(29,) 
  30, // layer_bounds(30,) 
  31, // layer_bounds(31,) 
  32, // layer_bounds(32,) 
  33, // layer_bounds(33,) 
  34, // layer_bounds(34,) 
  35, // layer_bounds(35,) 
  36, // layer_bounds(36,) 
  37, // layer_bounds(37,) 
  38, // layer_bounds(38,) 
  39, // layer_bounds(39,) 
  40, // layer_bounds(40,) 
  41, // layer_bounds(41,) 
  42, // layer_bounds(42,) 
  43, // layer_bounds(43,) 
  44, // layer_bounds(44,) 
  45, // layer_bounds(45,) 
  46, // layer_bounds(46,) 
  47; // layer_bounds(47,) 
 longitude =
  -180, // longitude(0,) 
  -175, // longitude(1,) 
  -170, // longitude(2,) 
  -165, // longitude(3,) 
  -160, // longitude(4,) 
  -155, // longitude(5,) 
  -150, // longitude(6,) 
  -145, // longitude(7,) 
  -140, // longitude(8,) 
  -135, // longitude(9,) 
  -130, // longitude(10,) 
  -125, // longitude(11,) 
  -120, // longitude(12,) 
  -115, // longitude(13,) 
  -110, // longitude(14,) 
  -105, // longitude(15,) 
  -100, // longitude(16,) 
  -95, // longitude(17,) 
  -90, // longitude(18,) 
  -85, // longitude(19,) 
  -80, // longitude(20,) 
  -75, // longitude(21,) 
  -70, // longitude(22,) 
  -65, // longitude(23,) 
  -60, // longitude(24,) 
  -55, // longitude(25,) 
  -50, // longitude(26,) 
  -45, // longitude(27,) 
  -40, // longitude(28,) 
  -35, // longitude(29,) 
  -30, // longitude(30,) 
  -25, // longitude(31,) 
  -20, // longitude(32,) 
  -15, // longitude(33,) 
  -10, // longitude(34,) 
  -5, // longitude(35,) 
  0, // longitude(36,) 
  5, // longitude(37,) 
  10, // longitude(38,) 
  15, // longitude(39,) 
  20, // longitude(40,) 
  25, // longitude(41,) 
  30, // longitude(42,) 
  35, // longitude(43,) 
  40, // longitude(44,) 
  45, // longitude(45,) 
  50, // longitude(46,) 
  55, // longitude(47,) 
  60, // longitude(48,) 
  65, // longitude(49,) 
  70, // longitude(50,) 
  75, // longitude(51,) 
  80, // longitude(52,) 
  85, // longitude(53,) 
  90, // longitude(54,) 
  95, // longitude(55,) 
  100, // longitude(56,) 
  105, // longitude(57,) 
  110, // longitude(58,) 
  115, // longitude(59,) 
  120, // longitude(60,) 
  125, // longitude(61,) 
  130, // longitude(62,) 
  135, // longitude(63,) 
  140, // longitude(64,) 
  145, // longitude(65,) 
  150, // longitude(66,) 
  155, // longitude(67,) 
  160, // longitude(68,) 
  165, // longitude(69,) 
  170, // longitude(70,) 
  175; // longitude(71,) 
 etai_pressure =
  1013.25, // etai_pressure(0,) 
  998.05066226, // etai_pressure(1,) 
  982.7648815, // etai_pressure(2,) 
  967.47951125, // etai_pressure(3,) 
  952.1952377499999, // etai_pressure(4,) 
  936.910541, // etai_pressure(5,) 
  921.62574425, // etai_pressure(6,) 
  906.3422484999999, // etai_pressure(7,) 
  891.0591669250001, // etai_pressure(8,) 
  875.7762866749999, // etai_pressure(9,) 
  860.493406425, // etai_pressure(10,) 
  845.2110868749999, // etai_pressure(11,) 
  829.92944115, // etai_pressure(12,) 
  809.5556694999999, // etai_pressure(13,) 
  784.087993675, // etai_pressure(14,) 
  758.6210224250001, // etai_pressure(15,) 
  733.1596938, // etai_pressure(16,) 
  707.6988998750001, // etai_pressure(17,) 
  682.23863065, // etai_pressure(18,) 
  644.0535201499999, // etai_pressure(19,) 
  605.87975765, // etai_pressure(20,) 
  567.705907075, // etai_pressure(21,) 
  529.549899575, // etai_pressure(22,) 
  491.400941075, // etai_pressure(23,) 
  453.269419575, // etai_pressure(24,) 
  415.154738825, // etai_pressure(25,) 
  377.070069325, // etai_pressure(26,) 
  339.005327825, // etai_pressure(27,) 
  288.927350795, // etai_pressure(28,) 
  245.24617303, // etai_pressure(29,) 
  208.24424533125, // etai_pressure(30,) 
  176.9300082837372, // etai_pressure(31,) 
  150.393, // etai_pressure(32,) 
  127.837, // etai_pressure(33,) 
  108.663, // etai_pressure(34,) 
  92.36572, // etai_pressure(35,) 
  78.51231, // etai_pressure(36,) 
  56.38791, // etai_pressure(37,) 
  40.17541, // etai_pressure(38,) 
  28.36781, // etai_pressure(39,) 
  19.7916, // etai_pressure(40,) 
  9.292942, // etai_pressure(41,) 
  4.076571, // etai_pressure(42,) 
  1.65079, // etai_pressure(43,) 
  0.6167791, // etai_pressure(44,) 
  0.211349, // etai_pressure(45,) 
  0.06600001, // etai_pressure(46,) 
  0.01; // etai_pressure(47,) 
 layer =
  1, // layer(0,) 
  2, // layer(1,) 
  3, // layer(2,) 
  4, // layer(3,) 
  5, // layer(4,) 
  6, // layer(5,) 
  7, // layer(6,) 
  8, // layer(7,) 
  9, // layer(8,) 
  10, // layer(9,) 
  11, // layer(10,) 
  12, // layer(11,) 
  13, // layer(12,) 
  14, // layer(13,) 
  15, // layer(14,) 
  16, // layer(15,) 
  17, // layer(16,) 
  18, // layer(17,) 
  19, // layer(18,) 
  20, // layer(19,) 
  21, // layer(20,) 
  22, // layer(21,) 
  23, // layer(22,) 
  24, // layer(23,) 
  25, // layer(24,) 
  26, // layer(25,) 
  27, // layer(26,) 
  28, // layer(27,) 
  29, // layer(28,) 
  30, // layer(29,) 
  31, // layer(30,) 
  32, // layer(31,) 
  33, // layer(32,) 
  34, // layer(33,) 
  35, // layer(34,) 
  36, // layer(35,) 
  37, // layer(36,) 
  38, // layer(37,) 
  39, // layer(38,) 
  40, // layer(39,) 
  41, // layer(40,) 
  42, // layer(41,) 
  43, // layer(42,) 
  44, // layer(43,) 
  45, // layer(44,) 
  46, // layer(45,) 
  47; // layer(46,) 
 latitude =
  -89, // latitude(0,) 
  -86, // latitude(1,) 
  -82, // latitude(2,) 
  -78, // latitude(3,) 
  -74, // latitude(4,) 
  -70, // latitude(5,) 
  -66, // latitude(6,) 
  -62, // latitude(7,) 
  -58, // latitude(8,) 
  -54, // latitude(9,) 
  -50, // latitude(10,) 
  -46, // latitude(11,) 
  -42, // latitude(12,) 
  -38, // latitude(13,) 
  -34, // latitude(14,) 
  -30, // latitude(15,) 
  -26, // latitude(16,) 
  -22, // latitude(17,) 
  -18, // latitude(18,) 
  -14, // latitude(19,) 
  -10, // latitude(20,) 
  -6, // latitude(21,) 
  -2, // latitude(22,) 
  2, // latitude(23,) 
  6, // latitude(24,) 
  10, // latitude(25,) 
  14, // latitude(26,) 
  18, // latitude(27,) 
  22, // latitude(28,) 
  26, // latitude(29,) 
  30, // latitude(30,) 
  34, // latitude(31,) 
  38, // latitude(32,) 
  42, // latitude(33,) 
  46, // latitude(34,) 
  50, // latitude(35,) 
  54, // latitude(36,) 
  58, // latitude(37,) 
  62, // latitude(38,) 
  66, // latitude(39,) 
  70, // latitude(40,) 
  74, // latitude(41,) 
  78, // latitude(42,) 
  82, // latitude(43,) 
  86, // latitude(44,) 
  89; // latitude(45,) 
 time =
  248700; // time(0,) 
 longitude_bounds =
  -182.5, // longitude_bounds(0, 0) 
  -177.5, // longitude_bounds(0, 1) 
  -177.5, // longitude_bounds(1, 0) 
  -172.5, // longitude_bounds(1, 1) 
  -172.5, // longitude_bounds(2, 0) 
  -167.5, // longitude_bounds(2, 1) 
  -167.5, // longitude_bounds(3, 0) 
  -162.5, // longitude_bounds(3, 1) 
  -162.5, // longitude_bounds(4, 0) 
  -157.5, // longitude_bounds(4, 1) 
  -157.5, // longitude_bounds(5, 0) 
  -152.5, // longitude_bounds(5, 1) 
  -152.5, // longitude_bounds(6, 0) 
  -147.5, // longitude_bounds(6, 1) 
  -147.5, // longitude_bounds(7, 0) 
  -142.5, // longitude_bounds(7, 1) 
  -142.5, // longitude_bounds(8, 0) 
  -137.5, // longitude_bounds(8, 1) 
  -137.5, // longitude_bounds(9, 0) 
  -132.5, // longitude_bounds(9, 1) 
  -132.5, // longitude_bounds(10, 0) 
  -127.5, // longitude_bounds(10, 1) 
  -127.5, // longitude_bounds(11, 0) 
  -122.5, // longitude_bounds(11, 1) 
  -122.5, // longitude_bounds(12, 0) 
  -117.5, // longitude_bounds(12, 1) 
  -117.5, // longitude_bounds(13, 0) 
  -112.5, // longitude_bounds(13, 1) 
  -112.5, // longitude_bounds(14, 0) 
  -107.5, // longitude_bounds(14, 1) 
  -107.5, // longitude_bounds(15, 0) 
  -102.5, // longitude_bounds(15, 1) 
  -102.5, // longitude_bounds(16, 0) 
  -97.5, // longitude_bounds(16, 1) 
  -97.5, // longitude_bounds(17, 0) 
  -92.5, // longitude_bounds(17, 1) 
  -92.5, // longitude_bounds(18, 0) 
  -87.5, // longitude_bounds(18, 1) 
  -87.5, // longitude_bounds(19, 0) 
  -82.5, // longitude_bounds(19, 1) 
  -82.5, // longitude_bounds(20, 0) 
  -77.5, // longitude_bounds(20, 1) 
  -77.5, // longitude_bounds(21, 0) 
  -72.5, // longitude_bounds(21, 1) 
  -72.5, // longitude_bounds(22, 0) 
  -67.5, // longitude_bounds(22, 1) 
  -67.5, // longitude_bounds(23, 0) 
  -62.5, // longitude_bounds(23, 1) 
  -62.5, // longitude_bounds(24, 0) 
  -57.5, // longitude_bounds(24, 1) 
  -57.5, // longitude_bounds(25, 0) 
  -52.5, // longitude_bounds(25, 1) 
  -52.5, // longitude_bounds(26, 0) 
  -47.5, // longitude_bounds(26, 1) 
  -47.5, // longitude_bounds(27, 0) 
  -42.5, // longitude_bounds(27, 1) 
  -42.5, // longitude_bounds(28, 0) 
  -37.5, // longitude_bounds(28, 1) 
  -37.5, // longitude_bounds(29, 0) 
  -32.5, // longitude_bounds(29, 1) 
  -32.5, // longitude_bounds(30, 0) 
  -27.5, // longitude_bounds(30, 1) 
  -27.5, // longitude_bounds(31, 0) 
  -22.5, // longitude_bounds(31, 1) 
  -22.5, // longitude_bounds(32, 0) 
  -17.5, // longitude_bounds(32, 1) 
  -17.5, // longitude_bounds(33, 0) 
  -12.5, // longitude_bounds(33, 1) 
  -12.5, // longitude_bounds(34, 0) 
  -7.5, // longitude_bounds(34, 1) 
  -7.5, // longitude_bounds(35, 0) 
  -2.5, // longitude_bounds(35, 1) 
  -2.5, // longitude_bounds(36, 0) 
  2.5, // longitude_bounds(36, 1) 
  2.5, // longitude_bounds(37, 0) 
  7.5, // longitude_bounds(37, 1) 
  7.5, // longitude_bounds(38, 0) 
  12.5, // longitude_bounds(38, 1) 
  12.5, // longitude_bounds(39, 0) 
  17.5, // longitude_bounds(39, 1) 
  17.5, // longitude_bounds(40, 0) 
  22.5, // longitude_bounds(40, 1) 
  22.5, // longitude_bounds(41, 0) 
  27.5, // longitude_bounds(41, 1) 
  27.5, // longitude_bounds(42, 0) 
  32.5, // longitude_bounds(42, 1) 
  32.5, // longitude_bounds(43, 0) 
  37.5, // longitude_bounds(43, 1) 
  37.5, // longitude_bounds(44, 0) 
  42.5, // longitude_bounds(44, 1) 
  42.5, // longitude_bounds(45, 0) 
  47.5, // longitude_bounds(45, 1) 
  47.5, // longitude_bounds(46, 0) 
  52.5, // longitude_bounds(46, 1) 
  52.5, // longitude_bounds(47, 0) 
  57.5, // longitude_bounds(47, 1) 
  57.5, // longitude_bounds(48, 0) 
  62.5, // longitude_bounds(48, 1) 
  62.5, // longitude_bounds(49, 0) 
  67.5, // longitude_bounds(49, 1) 
  67.5, // longitude_bounds(50, 0) 
  72.5, // longitude_bounds(50, 1) 
  72.5, // longitude_bounds(51, 0) 
  77.5, // longitude_bounds(51, 1) 
  77.5, // longitude_bounds(52, 0) 
  82.5, // longitude_bounds(52, 1) 
  82.5, // longitude_bounds(53, 0) 
  87.5, // longitude_bounds(53, 1) 
  87.5, // longitude_bounds(54, 0) 
  92.5, // longitude_bounds(54, 1) 
  92.5, // longitude_bounds(55, 0) 
  97.5, // longitude_bounds(55, 1) 
  97.5, // longitude_bounds(56, 0) 
  102.5, // longitude_bounds(56, 1) 
  102.5, // longitude_bounds(57, 0) 
  107.5, // longitude_bounds(57, 1) 
  107.5, // longitude_bounds(58, 0) 
  112.5, // longitude_bounds(58, 1) 
  112.5, // longitude_bounds(59, 0) 
  117.5, // longitude_bounds(59, 1) 
  117.5, // longitude_bounds(60, 0) 
  122.5, // longitude_bounds(60, 1) 
  122.5, // longitude_bounds(61, 0) 
  127.5, // longitude_bounds(61, 1) 
  127.5, // longitude_bounds(62, 0) 
  132.5, // longitude_bounds(62, 1) 
  132.5, // longitude_bounds(63, 0) 
  137.5, // longitude_bounds(63, 1) 
  137.5, // longitude_bounds(64, 0) 
  142.5, // longitude_bounds(64, 1) 
  142.5, // longitude_bounds(65, 0) 
  147.5, // longitude_bounds(65, 1) 
  147.5, // longitude_bounds(66, 0) 
  152.5, // longitude_bounds(66, 1) 
  152.5, // longitude_bounds(67, 0) 
  157.5, // longitude_bounds(67, 1) 
  157.5, // longitude_bounds(68, 0) 
  162.5, // longitude_bounds(68, 1) 
  162.5, // longitude_bounds(69, 0) 
  167.5, // longitude_bounds(69, 1) 
  167.5, // longitude_bounds(70, 0) 
  172.5, // longitude_bounds(70, 1) 
  172.5, // longitude_bounds(71, 0) 
  177.5; // longitude_bounds(71, 1) 
 latitude_bounds =
  -90, // latitude_bounds(0, 0) 
  -88, // latitude_bounds(0, 1) 
  -88, // latitude_bounds(1, 0) 
  -84, // latitude_bounds(1, 1) 
  -84, // latitude_bounds(2, 0) 
  -80, // latitude_bounds(2, 1) 
  -80, // latitude_bounds(3, 0) 
  -76, // latitude_bounds(3, 1) 
  -76, // latitude_bounds(4, 0) 
  -72, // latitude_bounds(4, 1) 
  -72, // latitude_bounds(5, 0) 
  -68, // latitude_bounds(5, 1) 
  -68, // latitude_bounds(6, 0) 
  -64, // latitude_bounds(6, 1) 
  -64, // latitude_bounds(7, 0) 
  -60, // latitude_bounds(7, 1) 
  -60, // latitude_bounds(8, 0) 
  -56, // latitude_bounds(8, 1) 
  -56, // latitude_bounds(9, 0) 
  -52, // latitude_bounds(9, 1) 
  -52, // latitude_bounds(10, 0) 
  -48, // latitude_bounds(10, 1) 
  -48, // latitude_bounds(11, 0) 
  -44, // latitude_bounds(11, 1) 
  -44, // latitude_bounds(12, 0) 
  -40, // latitude_bounds(12, 1) 
  -40, // latitude_bounds(13, 0) 
  -36, // latitude_bounds(13, 1) 
  -36, // latitude_bounds(14, 0) 
  -32, // latitude_bounds(14, 1) 
  -32, // latitude_bounds(15, 0) 
  -28, // latitude_bounds(15, 1) 
  -28, // latitude_bounds(16, 0) 
  -24, // latitude_bounds(16, 1) 
  -24, // latitude_bounds(17, 0) 
  -20, // latitude_bounds(17, 1) 
  -20, // latitude_bounds(18, 0) 
  -16, // latitude_bounds(18, 1) 
  -16, // latitude_bounds(19, 0) 
  -12, // latitude_bounds(19, 1) 
  -12, // latitude_bounds(20, 0) 
  -8, // latitude_bounds(20, 1) 
  -8, // latitude_bounds(21, 0) 
  -4, // latitude_bounds(21, 1) 
  -4, // latitude_bounds(22, 0) 
  0, // latitude_bounds(22, 1) 
  0, // latitude_bounds(23, 0) 
  4, // latitude_bounds(23, 1) 
  4, // latitude_bounds(24, 0) 
  8, // latitude_bounds(24, 1) 
  8, // latitude_bounds(25, 0) 
  12, // latitude_bounds(25, 1) 
  12, // latitude_bounds(26, 0) 
  16, // latitude_bounds(26, 1) 
  16, // latitude_bounds(27, 0) 
  20, // latitude_bounds(27, 1) 
  20, // latitude_bounds(28, 0) 
  24, // latitude_bounds(28, 1) 
  24, // latitude_bounds(29, 0) 
  28, // latitude_bounds(29, 1) 
  28, // latitude_bounds(30, 0) 
  32, // latitude_bounds(30, 1) 
  32, // latitude_bounds(31, 0) 
  36, // latitude_bounds(31, 1) 
  36, // latitude_bounds(32, 0) 
  40, // latitude_bounds(32, 1) 
  40, // latitude_bounds(33, 0) 
  44, // latitude_bounds(33, 1) 
  44, // latitude_bounds(34, 0) 
  48, // latitude_bounds(34, 1) 
  48, // latitude_bounds(35, 0) 
  52, // latitude_bounds(35, 1) 
  52, // latitude_bounds(36, 0) 
  56, // latitude_bounds(36, 1) 
  56, // latitude_bounds(37, 0) 
  60, // latitude_bounds(37, 1) 
  60, // latitude_bounds(38, 0) 
  64, // latitude_bounds(38, 1) 
  64, // latitude_bounds(39, 0) 
  68, // latitude_bounds(39, 1) 
  68, // latitude_bounds(40, 0) 
  72, // latitude_bounds(40, 1) 
  72, // latitude_bounds(41, 0) 
  76, // latitude_bounds(41, 1) 
  76, // latitude_bounds(42, 0) 
  80, // latitude_bounds(42, 1) 
  80, // latitude_bounds(43, 0) 
  84, // latitude_bounds(43, 1) 
  84, // latitude_bounds(44, 0) 
  88, // latitude_bounds(44, 1) 
  88, // latitude_bounds(45, 0) 
  90; // latitude_bounds(45, 1) 
 time_bounds =
  248328, // time_bounds(0, 0) 
  249072; // time_bounds(0, 1) 
}

Fill in the options below to plot May ozone at the surface


In [26]:
!pncmap.py -f "bpch,nogroup=('IJ-AVG-\$',)" -v O3 -s layer72,? \
    bpch/ctm.bpch.v10-01-public-Run0.2013050100 map500hPa_


**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/geoschemfiles/_bpch.py:866:UserWarning:
  vertgrid selected (GEOS-5-REDUCED) and output layers are not consistent; update to GEOS-5-NATIVE (e.g., bpch(..., vertgrid='GEOS-5-NATIVE') -f "bpch,vertgrid='GEOS-5-NATIVE'"
**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/plotutil/pncmap.py:85:UserWarning:
  Autoselect deciles colormap of O3; override width --norm

CHECK POINT:

  • What warning do you get? How can you solve it?
  • What was the file name of the saved figure? (hint: use the --verbose option)
  • How could you change the pncmap.py call so that the VARNAME was just O3 and the output had just O3 in the label.

Plot the average May/June value

  • What does the --stack option do?
  • How could you combine it with the -r option to plot the average ozone in May and June?

*Note: the -f options are broadcast to both the May and June files. If they were different format (e.g., GEOS-Chem and ICARTT), we would need to treat them separately.

Make a Map with just DC3 Observations

Hint: pncmap.py expects latitude and longitude (case sensitive). You can use --expr or --rename to fix the case and --coordkeys to ensure these variables are not plotted and immune to -v.

Combining PNC commands

Notice that the commands necessary to open ICARTT (ffi1001) and GEOS-Chem (bpch) files were different. We can separate commands and apply them only to one file using the --pnc option. Make notes below about the pnc option:

Now use one command to make both maps.

  • Hint 1: Rename O3_ESRL to O3
  • Hint 2: Escaping quotes is important
  • Hint 3: Use --expr to redefine DC2 longitude on -182.5, 177.5 use np.where

ANSWERS Hidden

``` pncmap.py --norm="Normalize(0, 100)" -v O3 \ --pnc " -f bpch,nogroup=(\'IJ-AVG-$\',),vertgrid=\'GEOS-5-NATIVE\' \ --stack=time -r time,mean -s layer72,22 -v O3 \ bpch/ctm.bpch.v10-01-public-Run0.2013050100 bpch/ctm.bpch.v10-01-public-Run0.2013060100" \ --pnc " -f ffi1001 --rename v,O3_ESRL,O3 --expr=\"latitude=LATITUDE;longitude=np.where(LONGITUDE>180,LONGITUDE-360,LONGITUDE)\" icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict" \ map ```

Now lets make this map better!

  • Focus in on the observations region
  • Mask all observations that are not within the model layer pressures
  • Add a title

ANSWERS Hidden

``` --overlay" option --mask "where,PRESSURE>515.7865" --mask "where,PRESSURE<479.60059" --axes-keywords "title='one'" --plot-commands "plt.title('one')" ```

First make NetCDF copies of your results


In [27]:
!pncgen.py -O -f ffi1001 \
            --mask "where,PRESSURE>515.7865" \
            --mask "where,PRESSURE<479.60059" \
            --rename v,O3_ESRL,O3 --rename v,LATITUDE,latitude \
            -v Fractional_Day,O3_ESRL,LATITUDE,LONGITUDE,PRESSURE \
            --expr "longitude=np.where(LONGITUDE>180,LONGITUDE-360,LONGITUDE)" \
            --expr "time=Fractional_Day*24*3600" \
            --expr "time.units='seconds since 2011-12-31'" \
            icartt/dc3-mrg60-dc8_merge_20120518_R7_thru20120622.ict dc3.nc


**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/pncgen.py:78:UserWarning:
  Could not add as of 01/12/2016. to file; <class 'AttributeError'>: NetCDF: Name contains illegal characters
**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/pncgen.py:78:UserWarning:
  Could not add (e.g., to eliminate duplication) to file; <class 'AttributeError'>: NetCDF: Name contains illegal characters

In [28]:
!pncgen.py -O -f "bpch,nogroup=('IJ-AVG-$',),vertgrid='GEOS-5-NATIVE'" \
         --stack=time -s latitude,28,36 -s longitude,10,25 \
         -s layer72,22 -r time,mean -v O3 \
         bpch/ctm.bpch.v10-01-public-Run0.2013050100 bpch/ctm.bpch.v10-01-public-Run0.2013060100 \
         bpch_500hPa.nc


**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/core/_functions.py:831:UserWarning:
  Got duplicate variables for layer72 without stackable dimension; first value retained

Now use the command line to make the plot


In [29]:
!pncmap.py --overlay --norm="Normalize(0, 100)" -v O3 \
 bpch_500hPa.nc dc3.nc dc3bpchmap
%ls dc3bpchmap*


**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/coordutil.py:181:UserWarning:
  Latitude bounds are approximate
dc3bpchmapO30.png  dc3bpchmapO31.png

Evaluate Model with Observations


In [33]:
!pncscatter.py -v O3 \
        --plot-commands="plt.xlabel('Obs')" \
        --plot-commands="plt.ylabel('Mod')" \
        dc3.nc bpch_500hPa.nc scat
!pnceval.py --funcs=MB,ME -v O3 dc3.nc bpch_500hPa.nc


dc3nc_0 = ifile0 = dc3.nc
bpch_5_0 = ifile1 = bpch_500hPa.nc
**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/pnceval.py:371:UserWarning:
  Assumes input order is obs model
**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/pnceval.py:378:UserWarning:
  Skipped MB;operands could not be broadcast together with shapes (1,1,8,15) (6817,) 
**PNC:/Users/barronh/Development/pseudonetcdf/src/PseudoNetCDF/pnceval.py:378:UserWarning:
  Skipped ME;operands could not be broadcast together with shapes (1,1,8,15) (6817,) 


In [25]:
!pnceval.py --help


usage: pnceval.py [-h] [--verbose] [--pnc PNC]
                  [-f {see --list-formats for choices}]
                  [--list-format] [--help-format HELPFORMAT]
                  [--sep] [--inherit] [--mangle]
                  [--rename RENAME]
                  [--remove-singleton REMOVESINGLETON]
                  [--coordkeys key1,key2]
                  [-v varname1[,varname2[,...,varnameN]]
                  [-a att_nm,var_nm,mode,att_typ,att_val]
                  [-m MASKS] [--from-convention FROMCONV]
                  [--to-convention TOCONV] [--stack STACK]
                  [--merge] [-s dim,start[,stop[,step]]]
                  [-r dim,function[,weight]]
                  [--mesh dim,weight,function]
                  [-c dim,mode,wgt1,wgt2,...wgtN] [-e EXTRACT]
                  [--extract-file EXTRACTFILE]
                  [--extractmethod {nn,linear,cubic,quintic,KDTree}]
                  [--op-typ OPERATORS] [--expr EXPRESSIONS]
                  [--exprscript EXPRESSIONSCRIPTS] [-i] [-H]
                  [-t] [--full-indices [c|f]] [-l LEN]
                  [--float-precision FDIG]
                  [--double-precision PDIG]
                  [--dump-name CDLNAME] [--funcs FUNCS]
                  [ifiles [ifiles ...]]

PseudoNetCDF Argument Parsing

positional arguments:
  ifiles                path to a file formatted as type -f

optional arguments:
  -h, --help            show this help message and exit
  --verbose             Provides verbosity with pncgen
  --pnc PNC             Set of pseudonetcdf commands to be
                        process separately
  -f {see --list-formats for choices}, --format {see --list-formats for choices}
                        File format (default netcdf), can be
                        one of the choices listed, or an
                        expression that evaluates to a reader.
                        Keyword arguments are passed via
                        ,kwd=value.
  --list-format         Show format options for -f
  --help-format HELPFORMAT
                        Show help for file format (must be one
                        of the options for -f)
  --sep                 Used to separate groups of arguments
                        for parsing (e.g., pncgen -- [options1]
                        file(s)1 [--sep [options2] file(s)2
                        [... [--sep [optionsN] file(s)N]]
  --inherit             Allow subparsed sections (separated
                        with -- and --sep) to inherit from
                        global options (-f, --format is always
                        inherited).
  --mangle              Remove non-standard ascii from names
  --rename RENAME       Provide pairs of strings to be
                        substituted --rename=type,oldkey,newkey
                        (type: v = variable; d = dimension;)
  --remove-singleton REMOVESINGLETON
                        Remove singleton (length 1) dimensions
  --coordkeys key1,key2
                        Variables to be ignored in pncbo.
  -v varname1[,varname2[,...,varnameN], --variables varname1[,varname2[,...,varnameN]
                        Variable names or regular expressions
                        (using match) separated by ','. If a
                        group(s) has been specified, only
                        variables in that (those) group(s) will
                        be selected.
  -a att_nm,var_nm,mode,att_typ,att_val, --attribute att_nm,var_nm,mode,att_typ,att_val
                        Variables have attributes that can be
                        added following nco syntax (--attribute
                        att_nm,var_nm,mode,att_typ,att_val);
                        mode = a,c,d,m,o and att_typ =
                        f,d,l,s,c,b; att_typ is any valid numpy
                        type.
  -m MASKS, --mask MASKS
                        Masks to apply (e.g., greater,0 or
                        less,0 or values,0, or where,(time[:]%2
                        4<12)[:,None].repeat(10,1))
  --from-convention FROMCONV
                        From convention currently only support
                        ioapi
  --to-convention TOCONV
                        To convention currently only supports
                        cf
  --stack STACK         Concatentate (stack) files on the
                        dimension.
  --merge               Combine variables into one file
  -s dim,start[,stop[,step]], --slice dim,start[,stop[,step]]
                        Variables have dimensions (time, layer,
                        lat, lon), which can be subset using
                        dim,start,stop,stride (e.g.,
                        --slice=layer,0,47,5 would sample every
                        fifth layer starting at 0)
  -r dim,function[,weight], --reduce dim,function[,weight]
                        Variable dimensions can be reduced
                        using dim,function,weight syntax (e.g.,
                        --reduce=layer,mean,weight). Weighting
                        is not fully functional.
  --mesh dim,weight,function
                        Variable dimensions can be meshed using
                        dim,function,weight syntax (e.g.,
                        --mesh=time,0.5,mean).
  -c dim,mode,wgt1,wgt2,...wgtN, --convolve dim,mode,wgt1,wgt2,...wgtN
                        Variable dimension is reduced by
                        convolve function
                        (dim,mode,wgt1,wgt2,...wgtN)
  -e EXTRACT, --extract EXTRACT
                        lon/lat coordinates to extract lon1,lat
                        1/lon2,lat2/lon3,lat3/.../lonN,latN
  --extract-file EXTRACTFILE
                        pncparse options for file
  --extractmethod {nn,linear,cubic,quintic,KDTree}
                        Method for extraction
  --op-typ OPERATORS    Operator for binary file operations.
                        Binary file operations use the first
                        two files, then the result and the next
                        file, etc. Use // or <= or % or is not
                        or >> or & or == or != or + or * or -
                        or / or < or >= or ** or > or << or |
                        or is or ^
  --expr EXPRESSIONS    Generic expressions to execute in the
                        context of the file.
  --exprscript EXPRESSIONSCRIPTS
                        Generic expressions to execute in the
                        context of the file.
  -i, --interactive     Use interactive mode
  -H, --header
  -t, --timestring
  --full-indices [c|f]  Provide indices in CDL using either C
                        or Fortran style indexes. C style is
                        0-based and ordered from slowest
                        iterating dimension to fastest. Fortran
                        style is 1-based and ordered from
                        fastest to slowest iterating dimension
  -l LEN, --length LEN  CDL line length (pncdump only)
  --float-precision FDIG
                        single precision digitis (default 8;
                        pncdump only)
  --double-precision PDIG
                        pdig double precision digits (default
                        16; pncdump only)
  --dump-name CDLNAME   Name for display in ncdump
  --funcs FUNCS         Functions to evaluate split by ,
                        (default: NO,NP,NOP,MO,MP,MdnO,MdnP,STD
                        O,STDP,RM,RMdn,MB,MdnB,WDMB,WDMdnB,FB,M
                        NB,MdnNB,NMB,NMdnB,USUTPB,PSUTMNPB,PSUT
                        MdnNPB,PSUTNMPB,PSUTNMdnPB,ME,MdnE,WDME
                        ,WDMdnE,FE,MNE,MdnNE,NME,NMdnE,USUTPE,P
                        SUTMNPE,PSUTMdnNPE,PSUTNMPE,PSUTNMdnPE,
                        R2,RMSE,RMSEs,RMSEu,E1,IOA,d1,AC,WDIOA,
                        WDRMSE,WDAC)

Detailed Steps
--------------

PseudoNetCDF has many operations and the order often matters. The order is consistent with the order of options in the formatted help. The default order is summarized as:

1. Open with specified reader (-f)
2. Select subset of variables (-v)
2. Add attributes (-a)
4. Apply masks (--mask)
5. Add conventions to support later operations (--to-convention, --from-convention)
6. Combine files via stacking on dimensions (--stack)
7. Slice dimensions (-s --slice)
8. Reduce dimensions (-r --reduce)
9. Convolve dimensions (-c)
10. Extract specific coordinates (--extract)
11. Remove singleton dimensions (--remove-singleton)
12. Apply expressions (--expr then --exprscripts)
13. Apply binary operators (--op_typ)

To impose your own order, use standard options (global options) and then use -- to force positional interpretation of remaining options. In remaining options, use --sep to separate groups of files and options to be evaluated before any global operations.

Summary

You should be able to:

  1. Open data of different types.
  2. Characterize a dataset using the Common Data Language
  3. Slice and reduce dimensions.
  4. Create spatial plots with observations.
  5. Do a simple evaluation.

In [ ]: