This is a *much* less detailed answer than Jonathan's.
A simpleton approach.
===
(1) Are you writing netCDF?
(2) Are all stations supposed to provide observations at (say) 6 hour
intervals?
(3) All report the same variables p,u,v,t,q,......
(4) Some of the stations may not report each time period?
nsta = 1000
nday = 366 ; max number of days
nhr = 4
klev = 26 ; if more than 1 level
ntim = nday*nhr
The following generates arrays with missing values
staName = new( nsta, "string", "")
staId = new( nsta, "integer", -999)
t = new( (/nsta,ntim,klev/), "float", 1e20)
u = ...
v = ...
z = ...
etc
nid = -1
; loop read data (NAME, ID, T, ...)
ii = ind(staId.eq.ID) ; does an entry already exist?
if (ismissing(ii(0))) then
nid = nid + 1
staName(nid) = NAME
staId(nid) = ID
else
nid = ii(0)
end if
nt = ???
t(nid,nt,:) = T
u(nid,nt,:) = U
end loop
system("/bin/rm -f FOO.nc")
fo = addfile("FOO.nc" , "r")
fo->STATION_NAME = staName(0:nid) ; write a subset of the data
fo->STATION_ID = staId(0:nid)
f0->T = t(0:nid,:,:)
etc
????????
On 9/29/10 2:31 AM, Christopher Steele wrote:
> Hi everyone,
>
> I'm trying to read in a list of meteorological station files and extract
> the relevant data from them as one continuous time series. However, due
> to the nature of meteorological stations, not all report data at each
> time interval so I'm left with data files of varying lengths.
> Ordinarily, I would create a file list, preassign a new variable, and
> create a loop over the files and extract the data into the new variable
> so that I'm left with one continuous data set to work with.
> Unfortunately, I cannot do this if the length of the files are
> indeterminate. Short of going back to the original data files (of which
> there are many) and ensuring that all stations that do not report
> produce a nan, is there a way around this, or even a more efficient way
> of reading in data from multiple files?
>
> cheers
>
> Chris
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 29 15:23:05 2010
This archive was generated by hypermail 2.1.8 : Mon Oct 04 2010 - 08:55:54 MDT