[Thread Prev][Thread Next][Index]
Re: [ferret_users] grouping variables from an ensemble into a singlenetcdf file
Hi Alberto,
It can be done easily in Ferret bye defining a grid with 16
K levels and appending the K=2 variable from each ensemble file to this
new grid. For details please see the example below. To run this example
you may need to modify the input filename (it must have been easier if
you send the output of "show data" command for any of the input files).
If you face any problem with the example given below, mail back with
the names of your first few (say 2 or 3) files.
Please find the details in the example. Hope this helps
With Regards
Jaison
!-------------example.jnl----------------------------------
\ cancel mode verify
!
! open first input data set
use ensemble_1.nc ! put the proper filename here
! define the output grid
define axis/z=1:16:1/units=ensemble zensm ! you will ge some warning
! messages associated with this
! units...
let gout = x[gx=ht,d=1]*0 + y[gy=ht,d=1]*0 + z[gz=zensm]*0 + t[gt=ht,d=1]*0
! extract HT of K=2 on to the output grid
let ht_k2 = ht[d=1,k=2] + gout
! save the new variable as K=1 in the output file (open the output file
! such that it should have room for 16 levels but only one level is
! written now...)
set var/title="My variable : K=2 level"/units="meters" ht_k2
sp rm -f ensemble_k2_all.nc
save/file=ensemble_k2_all.nc/KLIMITS=1:16/K=1/quiet/CLOBBER ht_k2
! repeat it for other ensembles/input files
REPEAT/RANGE=2:16:1/name=nn (;\
define symbol en = `nn` ;\
cancel data 1 ;\
use ensemble_($en).nc ;\
let ht_k2 = ht[d=1,k=2] + gout ;\
save/file=ensemble_k2_all.nc/K=($en)/quiet/APPEND ht_k2 ;\
)
! if you want to preserve the same name "HT" in the output file...
cancel var/all ; cancel data/all
use ensemble_k2_all.nc
let ht = ht_k2[d=1] ! just rename the variable
set var/title="My variable : K=2 level"/units="meters" ht
sp rm -f ensemble_k2_all16.nc
set memory/size=100mb ! default memory may not be suffient
save/file=ensemble_k2_all16.nc/quiet/APPEND ht
! remove the unwanted files
sp rm -f ensemble_k2_all.nc
!
!-------------end of example.jnl------------------------------------------
On Wed, 7 Sep 2005, Arribas, Alberto wrote:
Dear ferreters,
I have a set of 16 files from an ensemble run which all contain the same
variables. For example:
name title I J K L
HT Height 1:288 1:217 1:4 1:13
I need to extract HT for k=2 (a certain height) for the all 16 files and
group it into a single file, therefore producing something like this:
name title I J K L
HT Height 1:288 1:217 1:16 1:13
in which the index k now refers to each ensemble member but all the
other index remain the same.
Could somebody give me advice on how to do this?
Thanks,
Alberto
-----
Alberto Arribas Ensemble Research Scientist
Met Office FitzRoy Road Exeter Devon EX1 3PB UK
Tel: +44 (0)1392 886518 Fax: +44 (0)1392 885681
E-mail: alberto.arribas@metoffice.gov.uk http://www.metoffice.gov.uk
[Thread Prev][Thread Next][Index]
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Contact Us | Privacy Policy | Disclaimer | Accessibility Statement