[Thread Prev][Thread Next][Index]

Re: [EXTERNAL] Re: [ferret_users] Produce a time serie by averaging a large variable



Hi Xiaoyu and Patrick

On Wed, Aug 2, 2023 at 7:17 AM Xiaoyu Bai <xbai1@xxxxxxxxxxxxx> wrote:
[ . . . ]
let ave = VMRN2O[k=@ave, l=@ave]
repeat/I=1:144 (repeat/J=1:143 (define symbole lat=`i`; save/append/file=grid_($lat)_`j`.nc ave))


I'd like to just add that you don't have to generate different files for different latitudes; you can just add latitude "slices" to an existing file.  Again, just to show the basic idea, here is pseudo code:

spawn rm tmpfile.nc ! delete the file
repeat/L=1:lmax ( \
   repeat/j=1:jmax ( \
      save/append/file=tmpfile.nc/jlimits=1:jmax ave ) )

You calculate the average latitude by latitude and add the result to the file.

Another consideration is: if at all possible, x=@ave and y=@ave should be calculated at the same time, because Ferret is smart enough to special-case this to calculate the true area average over the lon-lat grid boxes.

So, my recommendation would be to calculate the x-y average (var[x=@ave,y=@ave]) for each K and each L and store the result in a temporary netCDF file; then open the file and calculate the z average for each L.

Ryo


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement