Re: [idvusers] Viewing multiple, time-dependent netCDF files

Mike,

On Mon, Jan 26, 2009 at 12:18 PM, Mike Leuthold
<leuthold@xxxxxxxxxxxxxxxx> wrote:
> I've recently begun to explore IDV in order to visualize WRF output and I 
> have the same issue
> that Don Morton wrote about in2006, which is that I'd like open multiple 
> netCDF output files
> and be able to loop through them.  The solutions at the time were to use 
> netCDF Markup
> Language aggregation or cat grib files.  Has there been any work on using 
> multiple
> netCDF output files in IDV or am I totally missing this advance?


It's pretty easy to generate the NcML to do the aggregation.   Say you
have two files you want to aggregate in time are called
"wrf_2008021300.grib"
"wrf_2008021400.grib".
where each file contains a forecast at 3 hourly intervals.

Here are three different scenarios:

1. If both files have the same time units (e.g. "seconds since
1970-01-01" or something) and the first time step in the 2nd file
follows the last time step in the 1st file, then  "wrf_agg.ncml" could
be this simple:

<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2";>
         <aggregation dimName="time" type="joinExisting">
            <netcdf location="wrf_2008021300.grib"/>
            <netcdf location="wrf_2008021400.grib"/>
         </aggregation>
 </netcdf>

or you could scan all the .grib files in a specified directory instead
of specifying the specific names:

<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2";>
         <aggregation dimName="time" type="joinExisting">
           <scan location="/Volumes/models/wrf/" suffix=".grib"/>
         </aggregation>
 </netcdf>


2. If each file has different units for time (a different time
origin), as it often the case with Grib, then you can override the
time variable explicitly, giving a start and increment.

<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2";>
         <aggregation dimName="time" type="joinExisting">
            <netcdf location="wrf_2008021300_0000.grib"/>
            <netcdf location="wrf_2008021400_0000.grib"/>
         </aggregation>
         <variable name="time">
           <attribute name="units" type="String" value="hours since
2008-02-13 00:00 UTC"/>
          <values start="0" increment="3"/>
 </netcdf>


3. Finally, if each file contained a 48 hour forecast, but you wanted
only the 0-21 hour values from each, you could specify those values
explicitly.

<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2";>
         <aggregation dimName="time" type="joinExisting">
            <netcdf location="wrf_2008021300_0000.grib" coordValue="
 0   3   6   9  12  15  18  21   " />
            <netcdf location="wrf_2008021400_0000.grib" coordValue="
 0   3   6   9  12  15  18  21   " />
         </aggregation>
         <variable name="time">
          <attribute name="units" type="String" value="hours since
2008-02-13 00:00 UTC"/>
          <values start="0" increment="3"/>
 </netcdf>


There may be some even easier way to do it.   I trust the IDV guys
will speak up, if so!

-Rich


-- 
Dr. Richard P. Signell   (508) 457-2229
USGS, 384 Woods Hole Rd.
Woods Hole, MA 02543-1598