Overview

(part of the AQMEII-NA_N2O family of projects)

table of contents

description

Uses bash to drive NCL and R code to

  1. convert GEIA geospatial data from its quirky native format to netCDF.
  2. 2D-regrid netCDF data from global/unprojected to a projected subdomain (AQMEII-NA).
  3. "reunit" the data from GEIA's tonN/yr to moles/s (what CMAQ wants).
  4. "retemporalize" from yearly (single) timestep to CMAQ-style emissions files (e.g., this, when gunziped) containing hourly emissions usable for any day in the model year=2008.
  5. check that mass is (more or less) conserved in all of the above

Currently does not provide a clean or general-purpose (much less packaged) solution! This project merely shows how to perform these tasks using

  • bash (tested with version=3.2.25)
  • NCL (tested with version=6.1.2)
  • R (tested with version=3.0.0) and packages including

(Note this code was formerly housed at github, but was moved due to the github's change in upload/download policy. Also, IMHO, the bitbucket wikis render more attractively--YMMV.)

operation

To run this code,

  1. git clone this repo. (See commandlines on the project homepage, where you probably are now.)
  2. cd to its working directory (where you cloned it to).
  3. Setup your applications and paths.
    1. Download a copy of these bash utilities to the working directory.
    2. Open the file in in an editor! You will probably need to edit its functions setup_paths and setup_apps to make it work on your platform. Notably you will want to point it to your PDF viewer and NCL and R executables.
    3. You may also want to open the driver (bash) script in an editor and take a look. It should run Out Of The Box, but you might need to tweak something there. In the worst case, you could hardcode your paths and apps in the driver.
    4. Once you've got it working, you may want to fork it. If so, you can automate running your changes with uber_driver.sh (changing that as needed, too).
  4. Run the driver: $ ./GEIA_driver.sh This will download input (and possibly git clone the regrid_utils), then run
    • an R script to convert the input to a netCDF file, and plot it. The driver should display a PDF if properly configured.
    • another R script to regrid the netCDF, and plot the output. The driver should display a PDF if properly configured. This PDF currently has 2 pages (p1 using raster::plot and p2 using fields::image.plot).
    • an NCL script to convert regridded concentrations to units appropriate for CMAQ (and with IOAPI metadata) and display the output using VERDI.
    • an NCL script to check conservation of mass from input to output. Given that the output domain (AQMEII-NA) is significantly smaller than the input domain (global), it merely reports the fraction of mass in output vs input, and compares that to an estimation of the land area of the output domain relative to the input domain. Current output is

          Is N2O conserved from input to output? units=ton-N
          (TODO: compare global ocean area to AQMEII-NA ocean area)
              input      input     output     output           
             global        NAs  AQMEII-NA        NAs     out/in
           3.60e+06      28657   1.06e+06      90768   2.96e-01
      

TODOs

  1. Retest with newest regrid_utils! Currently, repo_diff.sh shows the following local diffs:
    • string.ncl
    • summarize.ncl
  2. Move all these TODOs to issue tracker.
  3. Create common project for regrid_resources à la regrid_utils, so I don't hafta hunt down which resource is in which project.
  4. *.sh: use bash booleans à la N2O_integration_driver.sh.
  5. (this project only?) Use the EPIC input as template.
  6. All regrids: how to nudge off/onshore as required? e.g., soil or burning emissions should never be offshore, marine emissions should never be onshore.
  7. All regrid maps: add Caribbean islands (esp Bahamas! for offshore burning), Canadian provinces, Mexican states.
  8. Complain to ncl-talk about NCL "unsupported extensions," e.g., .ncf and <null/> (e.g., MCIP output).
  9. Determine why <- assignment is occasionally required in calls to visualize.*(...).
  10. Fully document platform versions (e.g., linux, compilers, bash, NCL, R).
  11. Test on
    • tlrPanP5 (which now has R package=ncdf4, but readAsciiTable of input .txt's is very slow compared to terrae)
    • HPCC (once problem with ncdf4 on amad1 is debugged: in process with JOB and KMF)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.