[Thread Prev][Thread Next][Index]

[ferret_users] Attempting to weight cell values by average cell area of grid



Hello Everyone

I am using Ferret to pre-process my data that I got
from NCEP. I have already successfully calculated the
climatological anomalies, but I am having trouble
weighting the cell values by their areas.

My current thought has been to use a global variable with
its cell the values set to one. Then find each cell's area in
this region and divide it by the average cell area. This would
then give a global weighting variable which I could then apply
to my data. However my problem is that I can't yet
get the cell_area out of the loop, and ones[i=@din, j=@din]
returns the area for the entire globe. Please can someone help
me with weighting my grid values by the cell areas.

I have included the script, netcdf header information, and
the netcdf file (for 1 month). I am using Ferret v6.3
in Linux Ubuntu Intrepid.

Thanks in advance
Michael

test.jnl:

!==========
use "test.nc"
! Create a variable over the globe where each cell's value is one
let + (0*x[gx=air_subset] + 0*y[gy=air_subset])

let max_lon = 144
let max_lat = 73
REPEAT/j=1:`max_lat` ( ;\
        REPEAT/i=1: `max_lon` ( ;\
            let cell_area = ones[i=@din, j=@din] ;\
            say `cell_area` ;\
        ) ;\
)
!==========

ncdump -h test.nv:

netcdf test {
dimensions:
    LON = 144 ;
    LAT = 73 ;
    LEVEL = 17 ;
    TIME = UNLIMITED ; // (1 currently)
    bnds = 2 ;
variables:
    double LON(LON) ;
        LON:units = "degrees_east" ;
        LON:long_name = "Longitude" ;
        LON:point_spacing = "even" ;
        LON:modulo = 360. ;
        LON:axis = "X" ;
    double LAT(LAT) ;
        LAT:units = "degrees_north" ;
        LAT:long_name = "Latitude" ;
        LAT:point_spacing = "even" ;
        LAT:axis = "Y" ;
    double LEVEL(LEVEL) ;
        LEVEL:units = "millibar" ;
        LEVEL:long_name = "Level" ;
        LEVEL:positive = "down" ;
        LEVEL:point_spacing = "even" ;
        LEVEL:axis = "Z" ;
    double TIME(TIME) ;
        TIME:units = "hours since 0001-01-01 00:00:00" ;
        TIME:long_name = "Time" ;
        TIME:time_origin = "01-JAN-0001 00:00:00" ;
        TIME:axis = "T" ;
        TIME:bounds = "TIME_bnds" ;
    double TIME_bnds(TIME, bnds) ;
    float AIR_SUBSET(TIME, LEVEL, LAT, LON) ;
        AIR_SUBSET:missing_value = -1.e+34f ;
        AIR_SUBSET:_FillValue = -1.e+34f ;
        AIR_SUBSET:long_name = "AIR_ANOMALY[T=\"1-JAN-1957\":\"1-JAN-1957\"]" ;
        AIR_SUBSET:history = "From air_anomaly" ;

// global attributes:
        :history = "FERRET V6.3   3-Nov-09" ;
        :Conventions = "CF-1.0" ;
}



Attachment: test.nc
Description: Cdf file


[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement