making cf compliant
Model data comes in a variety of formats, and not all of them are particularly useful. To be useful, a model output format must be: fully self-describing, follow widely accepted conventions, and be supported by analysis softwares. The most widely supported format is NetCDF. Many applications (e.g., ArcGIS, R, matlab, python, Panoply, IDV, VERDI, etc) have support for NetCDF so long as the file uses an accepted meta data convention. The most thoroughly useful convention is the Climate and Forecasting convention (CF). A CF compliant software describes time, place, and measured quantity thoroughly. This avoids ambiguity in subsequent analysis. Unfortunately, most models do not output CF compliant data. Adding that level of data can be easily done so that future analysis is a snap. This tutorial will guide you through converting model data to CF compliant output in a NetCDF format..
The steps detailed below will be addressed for specifically and generally. The specific details will be provided for GEOS-Chem, CAMx, and CMAQ. The general details are provided to facilitate extension of these techniques to other models. Broadly, there are 2 high level steps.
- If necessary, convert model output format to NetCDF,
- Add meta data to the file and variables
Usually, these steps are handled simultaneously and automatically using the command below
Run `python -m PseudoNetCDF.pncgen -f `
- PseudoNetCDF is a free package that is already installed at UF. To enable it, you must run `source /hpc/scratch/barronh/aqc/bin/activate`
- "pncgen" is like ncgen from the NetCDF tutorial, except that it allows the input format to be one of many recognized formats
- "-f " tells pncgen that the file format (-f) is
- is the path to the model file to be converted
CMAQ data is already NetCDF, but it has only the IOAPI meta data. To create a new copy with CF meta-data, run the command above replacing with ioapi.
CAMx data is in an obscure format designed in the 1980s when meta-data was less important than limiting the total data size. To create a new copy in NetCDF format with CF meta-data, run the above command replacing with uamiv. Prior to CAMx version 6, there was also missing meta-data. So if your file is from then, is more complex. In this case, replace with the details below
Values for each parameter will depend on the map projection of the CAMx file (e.g., P_ALP=30). Below the values are described for the lambert conical projection or LCC:
- P_ALP = primary true latitude (positive is north of the equator; negative is south)
- P_BET = secondary true latitude (positive is north of the equator; negative is south)
- P_GAM = true longitude (positive is east of the prime meridian; negative is west)
- XCENT = central longitude (positive is east of the prime meridian; negative is west)
- YCENT = central latitude (positive is north of the equator; negative is south)
GEOS-Chem data is in the Binary Punch file format (bpch) and does not have all the meta-data necessary to describe it. The meta-data, however, can usually be correctly identified heuristically. To create a copy in NetCDF format with CF meta-data, replace with bpch.
The latitudes and longitudes are determined based on actual meta-data. The layer structure can only be determined if the output file contains surface pressures or pressure edge values. If the pressure values are not available, the output file will utilize the layer structure as documented in the GEOS-Chem on-line manual.