[Thread Prev][Thread Next][Index]

Re: multi-netcdf files for ensemble simulations





Hi Sonia

I can't remember if I've had this particular problem, but I do have a script that I believe is a solution. I concatenate a bunch of NetCDF files, but join them on the t-axis. Please see script below. (I imagine it's straightforward to change this script to work with the z-axis.)

Hope this helps,
Rob

Rob Scott
Research Associate
Institute for Geophysics
University of Texas at Austin
4412 Spicewood Springs Rd.
Building 600
Austin, TX
78759

Office: +1-512-471-0375


Dear Ferreters,

Hopefully someone already found a solution to the following problem:

I have a series of NetCDF files entailing output from GCM ensemble simulations.
In order to analyse the data, it would help me to be able to concatenate the
NetCDF files on one axis, with each axis "level" corresponding to one member of
the ensemble (I thought of using the Z axis for this as I only have surface
fields).

I did a few tests following the instructions from Chap. 10 Sec. 2, however, the
output file does never entail more than one z-level (see attachment). Did anyone
have this problem before and manage to find a solution?

Thank you very much!
Sonia


!------------------------------------------------------------------------------
! join ssh files along the time axis
!------------------------------------------------------------------------------

! must specify:
SET REGION/Y=8N:60N/X=120E:260E
DEFINE SYMBOL out_file = ssha_aviso_NP.cdf

!------------------------------------------------------------------------------
! ssh, access many files:
!------------------------------------------------------------------------------
let names = {spawn:"ls /rbs0/Altimeter_data/Aviso/MERCATOR/hh_msla_oer_merged_h_*"}
!------------------------------------------------------------------------------
! setup & clobber an empty NetCDF file
!------------------------------------------------------------------------------
SET DATA " `names[i=1]` "
DEFINE AXIS/T=15627:19036:7/UNITS=DAYS taxis
DEFINE GRID/LIKE=grid_0001/T=taxis grid_aviso
LET/TITLE="AVISO Sea Surface Height Anomaly"/UNITS=m \
ssha = (1/0) * x[G=grid_aviso] * y[G=grid_aviso] * t[G=grid_aviso]
SET MEMORY/SIZE=268
SAVE/CLOBBER/FILE=($out_file)/RIGID/LLIMITS=1:488 ssha

!------------------------------------------------------------------------------
! required variable definitions
!------------------------------------------------------------------------------
LET dummie = x[G=grid_aviso] * y[G=grid_aviso] * t[G=grid_aviso]
! (change ssha from cm to m)
LET ssha_tmp = grid_0001/100
!------------------------------------------------------------------------------
! now append the rest
!------------------------------------------------------------------------------
REPEAT/k=1:488 (LET a = names[i=`k`]; \
SET DATA/regulart " `a` "; \
DEFINE AXIS/T=15627:19036:7/UNITS=DAYS taxis ;\
DEFINE GRID/LIKE=grid_0001/T=taxis grid_aviso ;\
LET/TITLE="AVISO Sea Surface Height Anomaly"/UNITS=m ssha = RESHAPE(ssha_tmp,dummie[L=`k`]); \
SAVE/APPEND/FILE=($out_file)/RIGID/LLIMITS=1:488 ssha[L=`k`]; \
CANCEL DATA /ALL ;\
CANCEL AXIS/ALL)
!------------------------------------------------------------------------------
! did it work?
! remove def of ssha so as to not confuse it
!------------------------------------------------------------------------------
CANCEL VAR ssha
USE ($out_file)
SHOW DATA/VAR





[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement