[Thread Prev][Thread Next][Index]

Re: How to handle the mean of multiple files



Hello,
If I understand what you are doing, I think that you do not need REPEAT
commands at all, and that you do not need to do separate steps to form
the average for each Z level. If you have the same time axis in each file,
and the same set of levels, then you should be able to do it in just one
step. This is the great strength of Ferret, to operate on entire grids
without having to write loops.

use output.00.nc
use output.06.nc
use output.12.nc
use output.18.nc
set region/x=1:357.5/y=-90:90

let umean=(u[d=1]+u[d=2]+u[d=3]+u[d=4])/4
let vmean=(v[d=1]+v[d=2]+v[d=3]+v[d=4])/4
save/file=outputmean.nc umean,vmean

If the time axis is different in the files, then you will need to do
some steps to put the variables onto a common axis before
forming the mean, and I can help with that if you need assistance.
If the above does not work, then could you tell more about the
grids in the files; what is the output of

USE output.00.nc
SHOW GRID u[d=1]
SHOW AXIS axisname ! where axisname is the name of the time axis
! seen in the output of SHOW GRID.



du hui wrote:

> Dear ferret users: I have sent a email about the question to how to do
> the mean of the 4 files. But I think I made a mistake. I have
> re-edited my script as following, but it doesn't work
>
> use output.00.nc
> use output.06.nc
> use output.12.nc
> use output.18.nc
> set region/x=1:357.5/y=-90:90
>
> let umean=(u[d=1,k=1]+u[d=2,k=1]+u[d=3,k=1]+u[d=4,k=1])/4
> let vmean=(v[d=1,k=1]+v[d=2,k=1]+v[d=3,k=1]+v[d=4,k=1])/4
> repeat/l=1:731 save/file=outputmean.nc/append umean,vmean
>
> let umean=(u[d=1,k=2]+u[d=2,k=2]+u[d=3,k=2]+u[d=4,k=2])/4
> let vmean=(v[d=1,k=2]+v[d=2,k=2]+v[d=3,k=2]+v[d=4,k=2])/4
> repeat/l=1:731 save/file=outputmean.nc/append umean,vmean
>
>
> When I excuted the above script, after finishing the level 1, then the
> following messages appeared,
>
> let umean=(u[d=1,k=2]+u[d=2,k=2]+u[d=3,k=2]+u[d=4,k=2])/4
> let vmean=(v[d=1,k=2]+v[d=2,k=2]+v[d=3,k=2]+v[d=4,k=2])/4
> repeat/l=1:731 save/file=outputmean.nc/append umean,vmean
> !-> REPEAT: L=1
> LISTing to file outputmean.nc
> **TMAP ERR: Requested data range is outside of data set limits
> Expected: UMEAN[K= 2 : 2 ] Found: UMEAN[K= 1 : 1 ]
> LIST/FORMAT=CDF/file=outputmean.nc/append umean,vmean
> Command file, command group, or REPEAT execution aborted
>
> What is the mistake in my script?
> Could anyone give me some hints for this problem
> Thanks a lot
>
> _________________________________________________________________
>  MSN Explorer: http://explorer.msn.com/lccn/




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement