I'd appreciate advice regarding tools and methods for transforming
values "contained" in one 2-d netCDF spatial grid in one {projection,
resolution} to another, or pointers to other resources to consult.
Apologies if the following is too verbose (I'm guessing this is a
common usecase) or uses the wrong vocabulary (please correct where
needed), but here's what I mean:
I want to take N2O emissions from various sources in the contiguous US
(CONUS) and input them to a particular atmospheric model (CMAQ). My
group has other inputs (notably, meteorology) for our usecase on a
12 km x 12 km Lambert conformal conic (LCC) grid, and the model wants
everything in one format, so I need to get our N2O emissions on that
12x12 LCC. However, most of my N2O emissions will be coming from
global inventories (EDGAR, GEIA, GFED) which are gridded lat-lon at
differing resolutions (e.g., 0.1x0.1°). So I need to "regrid" the
latter emissions. How to do? on linux, preferably programmatically.
Details:
EDGAR 4.2 gives the mass of N2O emitted from each 0.1x0.1° lat-lon
gridcell over the globe. From that I can subset the portion that
intersects the AQMEII North American grid
https://github.com/TomRoche/cornbeltN2O/wiki/AQMEII-North-American-domain
(Pretty sure I can do that with NCO.) I can then use R package=M3
http://cran.r-project.org/web/packages/M3/
to project the nodes of the EDGAR subgrid to LCC. Note that, @ 40° N
(middle latitude of this subgrid), each EDGAR gridcell's extents are
~11 km N-S x ~8.5 km E-W.
Over that "LCC EDGAR" subgrid I would (conceptually) overlay a 12x12
km LCC CMAQ grid. (Which of course will deviate slightly from those
exact dimensions--we have the exact grid centers, nodes, and areas.)
Given
1 the LCC EDGAR grid's extents are larger than the CMAQ grid's extents
(which I can make true)
2 each CMAQ gridcell is larger than each LCC EDGAR gridcell, over the
CMAQ grid's extents (which I believe is true, but should check)
3 each gridcell in either has no internal structure, so emissions
allocated to each gridcell are presumed to be "smeared evenly" by
area over the gridcell
each CMAQ gridcell will overlay between 2 and n LCC EDGAR gridcells
(guessing that n=4 in this case), and I can reallocate emissions
area-proportionally from each overlaid LCC EDGAR gridcell to the CMAQ
gridcell. This presumes that I can, programmatically,
1 identify each underlay (LCC EDGAR) gridcell that an overlay (CMAQ)
gridcell intersects
and, for each of the underlay gridcells U_i (with i in 1..n)
intersected by a given overlay gridcell O,
2 identify the emissions attributed to U_i e_{U_i} (easy, just lookup)
3 identify the total area of U_i a_{U_i} (should be an easy
computation, given lookup of its corners/gridnodes)
4 identify the area of intersection I_i between U_i and O (I don't
know how to do that)
whereupon I can attribute to O emissions e_O =
\sum_{i=1}^{n} \frac{I_i U_i}{a_{U_i}}
This sounds doable, provided task 4 can be done programmatically, but
it also sounds error-prone, and I've got a lot of other work to do on
this project, so I'm more than willing to reuse existing code (esp R,
since that would fit with my other scripts).
Your coding recommendations are appreciated, as would be pointers to
helpful resources. Thanks in advance, and feel free to forward,
Tom Roche <Tom_Roche@xxxxxxxxx>