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

Mike,

I have another option which may or may not be easier or preferred to Rich's solution. I have an NCL script which creates CF compliant NetCDF files from native wrfout files. This script can be downloaded from the WRF-ARW Utility page (wrfout_to_cf.ncl at the bottom of the page):
  http://www.mmm.ucar.edu/wrf/users/utilities/util.htm
The NCL script allows you to select the fields to be included in the CF file as well as to put the data on pressure levels. The script is reasonably easy to run even if you have not used NCL much.

Once the wrfout files have been converted to CF compliant NetCDF files they can be easily handled and concatenated with NetCDF Operators (NCO) utilities. This would allow you to combine several files into one NetCDF file for use in IDV.

Mark

Rich Signell wrote:
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