[Thread Prev][Thread Next][Index]

Re: Concatting data files




Inresponse to my request for help in concatting data files into a time
series when all the files had the same time set, Lynn deWitt provided the
following solution.
(The trick being to specify the time attributed to the variable you 
concatting as you timestamp it).
	Jeff


USE test1.cdf, test2.cdf, test3.cdf

! define the p axis
DEFINE AXIS/T=1:3:1 tp
DEFINE GRID/T=tp gp

! define the "zero" value
LET zero = T[g=gp] * 0

! define the time-stamped variable
LET adv_stamped = zero + intjadv[t=330000]

! save all 3 sets in a time series
REPEAT/L=1:3 (SET DATA `L`; SAVE/APPEND/FILE=test.nc adv_stamped)


There's something about the time axis in your cdf files  - maybe because
the time is the same in all of them - that requires it be set specifically.
the following is an ncdump of the output file:


> ncdump test.nc
netcdf test {
dimensions:
        Z63_63 = 1 ;
        TP = UNLIMITED ; // (3 currently)
variables:
        double Z63_63(Z63_63) ;
                Z63_63:units = "D" ;
                Z63_63:point_spacing = "even" ;
        double TP(TP) ;
        float ADV_STANPED(TP, Z63_63) ;
                ADV_STANPED:missing_value = -1.e+34f ;
                ADV_STANPED:_FillValue = -1.e+34f ;
                ADV_STANPED:long_name = "ZERO + INTJADV[T=330000]" ;
                ADV_STANPED:history = "From test1" ;

// global attributes:
                :history = "FERRET V4.91 (GUI) 08-May-00" ;
data:

 Z63_63 = 0.981900274753571 ;

 TP = 1, 2, 3 ;

 ADV_STANPED =
  -1.736489e-14,
  -1.33962e-14,
  -9.226068e-15 ;
}


Lynn


--------------------------------------------
Lynn deWitt

ldewitt@pfeg.noaa.gov

Pacific Fisheries Environmental Laboratories
1352 Lighthouse Avenue
Pacific Grove, CA 93950-2097
(831)-648-9036

>------------------------------------------------------------
>Hello,
>
>I am trying to produce a times series for a variable from a number of
>files. I have tried various methods including the "timestamping" and the
>other methods found in the recent `Re: Concatting data from "degenerate"
>files...`
>I sent out a similar request for help last week and it was pointed out
>that I didn't really give enough information, so here is a code sample:
>
>
>!------ ! code to concat 3 data files to concat.cdf
>
>! We now have 3 new files
>! GO test
>
>! initialize the files
>USE test1.cdf, test2.cdf, test3.cdf
>
>! define the p axis
>DEFINE AXIS/T=1:3:1 tp
>DEFINE GRID/T=tp gp
>
>! define the "zero" value
>LET zero = T[g=gp] * 0
>
>! define the time-stamped variable
>LET adv_stamped = zero + intjadv
>
>! save all 3 sets in a time series
>REPEAT/X=1:3 (SET DATA `X`; SAVE/APPEND/FILE=concat.cdf adv_stamped)
>
>EXIT
>!------
>
>The problem is that the script, at each time step, writes the same value
>to each element of the concatination vector. It repeats this process
>three times. 
>I can't fathom how to get each value to its own element only.
>Incase you feel this is a worthy challenge I've included the three data
>files test{1,2,3}.cdf
>Thankyou for your time,
>        Jeff






[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement