(part of the AQMEII-NA_N2O family of projects)
table of contents
- "reunit" the data from CLM-CN-N2O's
molN2O/s(what CMAQ wants).
- 2D-regrid the data (in netCDF format) from global/unprojected to a projected subdomain (AQMEII-NA).
- "retemporalize" from monthly timestep to hourly, creating CMAQ-style emissions files (e.g., this, when
gunziped) containing hourly emissions usable for any day in the month labeled (e.g.,
200801in the link).
- 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
To run this code,
git clonethis repo.
cdto its working directory (where you cloned it to).
- Setup your applications and paths.
- Download a copy of these bash utilities to the working directory.
- Open the file in in an editor! You will probably need to edit its functions
setup_appsto make it work on your platform. Notably you will want to point it to your PDF viewer and NCL and R executables.
- 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.
- 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 if needed, too). If you fork, contribute back: make a pull request!
- Run the driver:
$ ./CLMCN_driver.shThis will download input, then run
- an NCL script to convert raw-input concentrations to units appropriate for CMAQ.
- an R script to plot the reunit-ed netCDF data, regrid it, and plot the output. The driver should display an input PDF and an output PDF if properly configured.
- an NCL script to "retemporalize" the regridded output into monthly files (since the input is monthly) with hourly timesteps (since at this point we have "flat temporality": we assume emission at constant
mol/sfor each hour of the month).
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 (as mgN) 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=mgN (note (US land area)/(earth land area) ~= 6.15e-02) input input output output month global NAs AQMEII-NA NAs out/in 1 3.83e+14 0 2.22e+12 0 5.78e-03 2 4.24e+14 0 2.33e+12 0 5.49e-03 3 4.67e+14 0 3.46e+12 0 7.41e-03 4 4.94e+14 0 6.60e+12 0 1.34e-02 5 4.94e+14 0 1.02e+13 0 2.06e-02 6 6.95e+14 0 1.77e+13 0 2.54e-02 7 8.61e+14 0 1.84e+13 0 2.14e-02 8 1.01e+15 0 1.74e+13 0 1.73e-02 9 8.08e+14 0 1.64e+13 0 2.03e-02 10 6.02e+14 0 1.04e+13 0 1.73e-02 11 4.72e+14 0 5.01e+12 0 1.06e-02 12 4.49e+14 0 3.67e+12 0 8.18e-03
- Retest with newest
repo_diff.shshows the following local
- Move all these TODOs to issue tracker.
*.sh: use bash booleans à la
- Create common project for
regrid_resourcesà la regrid_utils, so I don't hafta hunt down which resource is in which project.
- 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..
- All regrid maps: add Caribbean islands (esp Bahamas! for offshore burning), Canadian provinces, Mexican states.
- Complain to ncl-talk about NCL "unsupported extensions," e.g.,
<null/>(e.g., MCIP output).
- Determine why
<-assignment is occasionally required in calls to
- Fully document platform versions (e.g., linux, compilers, bash, NCL, R).
- 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)