Thanks Billy and Ansley for the suggestions/discussion. The following code, using xbox and ybox, should work for any model grid (...at least for the regular grid I'm using thus far). The formulas are based on Andrew Wittenberg's ferret documentation on grid cell areas (http://ferret.pmel.noaa.gov/Ferret/faq/averages-integrals-on-the-sphere). let modelName = $1 let r_Earth = 6371.E3 ! Earth's radius (m) use var_for_`modelName`.nc ! Load "var" from given model let pi=4*atan(1) let latRad = y[gy=var]*pi/180 ! Lats as radians let dlat = ybox[gy=var]*pi/180 ! lat spacing in radians let dlon = xbox[gx=var]*pi/180 ! ...lon spacing let cell_area = r_Earth^2 * cos(latRad) * dlon * 2 * sin(dlat/2) ! area (lon,lat) in m2 define att/output cell_area.units="m2" ! Save to netcdf (with useful meta data!) for some future use define att/output cell_area.long_name="Grid cell areas for `modelName` (r_Earth = `r_Earth` m)" save/file="cell_area_for_`modelName`.nc" cell_area ---- Cheers, Paul On Sep 13, 2011, at 4:40 PM, William S. Kessler wrote:
|