[Thread Prev][Thread Next][Index]

Re: how to append two data sets



On Tue, 15 Mar 2005, Prakya Shree Ram wrote:

> How can I merge two cdf data sets? I have both data
> sets in same grids and have same length and I want to
> write them in one file also would like to change the
> parameters name .  Please advise me.
>
Hi Sriram,
	Here is a ferret way, if you have two datesets with a common grid.

! access the two datsets
use dataset1.nc
use dataset2.nc

! suppose dataset1.nc has variables v1 on a grid that is exactly the
! same, apart from its name, as that for variable v2 in dataset2.nc
! then you could use

def grid/like=v1[d=1] gc
let/title="Renamed V1" va=v1[d=1,g=gc]
let/title="Renamed V1" vb=v2[d=2,g=gc]
save/file=combo.nc va,vb

! The new file "combo.nc" should contain both variables on their common
! grid.  However your message uses the word "merge" which seems to imply
! that the variables coming from the two input files do not share exactly
! the same grid. Perhaps they have a common x-y grid but each file has
! data from different times. Then you could merge the two datasets with
! an appropriate "if" definition

def axis/t=.... taxm            ! define the merged time axis
def grid/like=v1[d=1]/t=taxm gm ! the merged grid
let/title="Merged variable" vm=if(L le 5)then v1[d=1} else v2[d=2]

If neither of these situations match your case, and Paul's approach is
not a match, write again with further detail.
Good luck,
	Mick


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement