1. Tom Roche
  2. GEIA_regrid

Commits

Tom Roche  committed 029fddf

updated README testing from uber_driver pulling from repository

  • Participants
  • Parent commits 750cf56
  • Branches master

Comments (0)

Files changed (1)

File README.md

View file
-Uses [NCL][NCL @ wikipedia] and [R][R @ wikipedia] code to
+Uses [bash][bash @ wikipedia] to drive [NCL][NCL @ wikipedia] and [R][R @ wikipedia] code to
 
 1. convert [GEIA][] geospatial data from its quirky [native format][GEIA native format] to [netCDF][].
 1. 2D-regrid netCDF data from global/unprojected to a projected subdomain ([AQMEII-NA][]).
 1. "reunit" the data from GEIA's `tonN/yr` to `moles/s` (what CMAQ wants).
-1. "retemporalize" from yearly (single) timestep to hourly
+1. "retemporalize" from yearly (single) timestep to CMAQ-style emissions files (e.g., [this][emis_mole_N2O_2008_12US1_cmaq_cb05_soa_2008ab_08c.ncf.gz], when `gunzip`ed) containing hourly emissions usable for any day in the model year=2008. 
 1. check that mass is (more or less) conserved in all of the above
 
-creating CMAQ-style emissions files (e.g., [this][emis_mole_N2O_2008_12US1_cmaq_cb05_soa_2008ab_08c.ncf.gz], when `gunzip`ed) containing hourly emissions usable for any day in the model year=2008. Currently does not provide a clean or general-purpose (much less packaged) solution! Furthermore it currently has a functional problem (illustrated below). This project merely shows how to do these tasks using NCL (tested with version=6.1.2) and R (tested with version=2.15.2) and packages including
+Currently does not provide a clean or general-purpose (much less packaged) solution! Furthermore it currently has a functional problem (illustrated below). This project merely shows how to do these tasks using NCL (tested with version=6.1.2) and R (tested with version=2.15.2) and packages including
 
 * [ncdf4][]
 * [fields][]
 * [raster][]
 
-[R @ wikipedia]: http://en.wikipedia.org/wiki/R_%28programming_language%29
+[bash @ wikipedia]: http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29
 [NCL @ wikipedia]: http://en.wikipedia.org/wiki/NCAR_Command_Language
+[R @ wikipedia]: http://en.wikipedia.org/wiki/R_%28programming_language%29
 [netCDF]: http://en.wikipedia.org/wiki/NetCDF#Format_description
 [GEIA]: http://www.geiacenter.org/
 [GEIA native format]: /TomRoche/GEIA_to_netCDF/blob/master/GEIA_readme.txt
 [fields]: http://cran.r-project.org/web/packages/fields/
 [raster]: http://cran.r-project.org/web/packages/raster/
 
-The simplest way to run this code is to download and run [uber_driver.sh][], which automates the following steps. (Be sure to edit it, as discussed in the file, to match your local conditions and intentions!) Alternatively, one may manually
+To run this code,
 
 1. `git clone` this repo.
 1. `cd` to its working directory (where you cloned it to).
-1. Open the [driver (bash) script][reformat_regrid_reunit_retemp.sh] in an editor! You will probably need to edit it to make it work on your platform. Notably you will probably want to point it to your R executable and PDF viewer.
+1. Open the [bash utilities][bash_utilities.sh] in an editor! You will probably need to edit the functions `setup_paths` and `setup_apps` to make it work on your platform. Notably you will probably want to point it to your PDF viewer and NCL and R executables.
+    1. You may also want to open the [driver (bash) script][GEIA_driver.sh] 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.
+    1. 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).
 1. Run the driver:
-    `$ ./reformat_regrid_reunit_retemp.sh`
+    `$ ./GEIA_driver.sh`
 1. This will download input, then run
-    * an [R script][reformat_GEIA_to_netCDF.r] to convert the input to a netCDF file, and plot it. The driver should display [a PDF][reformatting plot] if properly configured.
+    * an [R script][reformat_GEIA_to_netCDF.r] to convert the input to a [netCDF][] file, and plot it. The driver should display [a PDF][reformatting plot] if properly configured.
     * another [R script][regrid_global_to_AQMEII.r] to regrid the netCDF, and plot the output. The driver should display [a PDF][regridding plot] if properly configured. This PDF currently has 2 pages (p1 using `raster::plot` and p2 using `fields::image.plot`).
     * an [NCL script][retemp_reunit.ncl] to [convert regridded concentrations][GEIA input processing @ project wiki] to units appropriate for [CMAQ][CMAQ @ CMAS].
     * an [NCL script][check_conservation.ncl] 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
-1. check that mass is (more or less) conserved in all of the above
-
-creating CMAQ-style emissions files (e.g., [this][emis_mole_N2O_2008_12US1_cmaq_cb05_soa_2008ab_08c.ncf.gz], when `gunzip`ed) containing hourly emissions usable for any day in the year. Currently does not provide a clean or general-purpose (much less packaged) solution! but merely shows how to do these tasks using NCL (tested with version=6.1.2) and R (tested with version=2.15.2) and R packages including
-
-* [ncdf4][]
-* [raster][]
-* [rasterVis][]
-
-[R @ wikipedia]: http://en.wikipedia.org/wiki/R_%28programming_language%29
-[NCL @ wikipedia]: http://en.wikipedia.org/wiki/NCAR_Command_Language
-[netCDF]: http://en.wikipedia.org/wiki/NetCDF#Format_description
-[EDGAR 4.2 overview]: http://edgar.jrc.ec.europa.eu/overview.php?v=42
-[EDGAR 4.2 categories]: http://edgar.jrc.ec.europa.eu/methodology.php#12sou
-[EDGAR categories in this study]: https://github.com/TomRoche/cornbeltN2O/wiki/Simulation-of-N2O-Production-and-Transport-in-the-US-Cornbelt-Compared-to-Tower-Measurements#wiki-EDGAR-4.2-categories
-[CMAQ @ CMAS]: http://www.cmaq-model.org/
-[AQMEII-NA]: https://github.com/TomRoche/cornbeltN2O/wiki/AQMEII-North-American-domain
-[emis_mole_N2O_2008_12US1_cmaq_cb05_soa_2008ab_08c.ncf.gz]: 
-[ncdf4]: http://cran.r-project.org/web/packages/ncdf4/
-[raster]: http://cran.r-project.org/web/packages/raster/
-[rasterVis]: http://cran.r-project.org/web/packages/rasterVis/
-
-The simplest way to run this code is to download and run [uber_driver.sh][], which automates the following steps. (Be sure to edit it, as discussed in the file, to match your local conditions and intentions!) Alternatively, one may manually
-
-1. `git clone` this repo.
-1. `cd` to its working directory (where you cloned it to).
-1. Open the [driver (bash) script][sum_reunit_regrid_retemp.sh] in an editor! You will probably need to edit it to make it work on your platform. Notably you will probably want to point it to your R executable and PDF viewer.
-1. Run the driver:
-    `$ ./sum_reunit_regrid_retemp.sh`
-1. This will download input, then run
-    * an [R script][sum_reunit.r] to sum the raw inputs, convert that intermediate product from mass flux to molar-mass rate, and plot it. The driver should display [a global plot][edgar_non-ag_summed_massed.pdf] if properly configured.
-    * an [R script][regrid_global_to_AQMEII.r] to regrid the previous product, and plot the output. The driver should display [an AQMEII plot][GEIA_N2O_oceanic_regrid.pdf] if properly configured.
-    * an [NCL script][retemp.ncl] to [generate hourly output][emis_mole_N2O_2008_12US1_cmaq_cb05_soa_2008ab_08c.ncf] suitable for input to [CMAQ][CMAQ @ CMAS].
-    * an [NCL script][check_conservation.ncl] to check conservation of mass from input to output. Current output is
 
                 Is N2O conserved from input to output? units=ton-N
                 (TODO: compare global ocean area to AQMEII-NA ocean area)
                    global        NAs  AQMEII-NA        NAs     out/in
                  3.60e+06      28657   1.06e+06      90768   2.96e-01
 
-[uber_driver.sh]: https://bitbucket.org/tlroche/geia_regrid/src/2d761c287ed7f0f5cdc65f89bff50e39b8e87624/uber_driver.sh?at=master
+[bash_utilities.sh]: https://bitbucket.org/tlroche/geia_regrid/src/750cf565f859a51e72c616dfbc4d8bf841ff7f06/bash_utilities.sh?at=master
+[GEIA_driver.sh]: https://bitbucket.org/tlroche/geia_regrid/src/750cf565f859a51e72c616dfbc4d8bf841ff7f06/GEIA_driver.sh?at=master
+[uber_driver.sh]: https://bitbucket.org/tlroche/geia_regrid/src/750cf565f859a51e72c616dfbc4d8bf841ff7f06/uber_driver.sh?at=master
 [reformatting plot]: https://bitbucket.org/tlroche/geia_regrid/downloads/GEIA_N2O_oceanic.pdf
 [regridding plot]: https://bitbucket.org/tlroche/geia_regrid/downloads/GEIA_N2O_oceanic_regrid.pdf
 [GEIA input processing @ project wiki]: https://github.com/TomRoche/cornbeltN2O/wiki/Simulation-of-N2O-Production-and-Transport-in-the-US-Cornbelt-Compared-to-Tower-Measurements#wiki-input-processing-GEIA
 [CMAQ @ CMAS]: http://www.cmaq-model.org/
-[reformat_regrid_reunit_retemp.sh]: https://bitbucket.org/tlroche/geia_regrid/src/cbb6368fb7d9924280095f5f9add6a3c62684be0/reformat_regrid_reunit_retemp.sh?at=master
+[GEIA_driver.sh]: https://bitbucket.org/tlroche/geia_regrid/src/750cf565f859a51e72c616dfbc4d8bf841ff7f06/GEIA_driver.sh?at=master
 [reformat_GEIA_to_netCDF.r]: https://bitbucket.org/tlroche/geia_regrid/src/cbb6368fb7d9924280095f5f9add6a3c62684be0/reformat_GEIA_to_netCDF.r?at=master
 [regrid_global_to_AQMEII.r]: https://bitbucket.org/tlroche/geia_regrid/src/cbb6368fb7d9924280095f5f9add6a3c62684be0/regrid_global_to_AQMEII.r?at=master
 [retemp_reunit.ncl]: https://bitbucket.org/tlroche/geia_regrid/src/2d761c287ed7f0f5cdc65f89bff50e39b8e87624/retemp_reunit.ncl?at=master