[Met_help] sample nc file

John Halley Gotway johnhg at rap.ucar.edu
Thu Mar 26 10:37:20 MDT 2009


Dave,

I made a few modifications to the NetCDF file you sent me and tried running the data through MODE.  I've attached a MODE (object based verification) PostScript plot which compares precipitation rate
to temperature from the same file - not that this is something you'd actually want to do in practice.  I just wanted to make sure MET could read the NetCDF file.

I'm not sure what type of verification methods you'd like to apply.  But I should mention that using an object-based approach like MODE may be problematic.  Since your domain is relatively small
relative to the size of features you'd be looking at, you'd have a continual problem with edge effects.  It may still be possible to get some useful information from MODE for this domain, but you'd
need to be cautious in your interpretation.

The additional changes you should make to the NetCDF file are the following:

(1) Set the accumulation times to 0 for all of these variables.  Really the only variables that would have a non-zero accumulation time are precipitation-type variables accumulated over some number of
hours or minutes.  Your rain rate variable is an instantaneous rain rate, rather than an accumulation over time.

(2) Rename the variables to use the corresponding GRIB code abbreviations.  They are defined in this table:
http://www.nco.ncep.noaa.gov/pmb/docs/on388/table2.html

In your NetCDF file, I renamed the variables as follows:
RAINRATE: Rename to PRATE for Precipitation Rate (GRIB code 59)
PSFC:     Rename to PRES for Pressure (GRIB code 1)
V2D:      Rename to VGRD for V-Component of the wind (GRIB code 34)
U2D:      Rename to UGRD for U-Component of the wind (GRIB code 33)
Q2D:      Rename to SPFH for Specific Humidity (GRIB code 51)
T2D:      Rename to TMP for Temperature (GRIB code 11)

Now, I'm not sure what the LWDOWN and SWDOWN variables mean.  But I'm guessing it's one of the following:
- NSWRS and NLWRS for Net short and long-wave radiation flux (surface) - GRIB codes 111 and 112
- SWAVR and LWAVR for short and long-wave readiation flux - GRIB codes 115 and 116
- LHTFL and SHTFL for latent and sensible heat net flux - GRIB codes 121 and 122
- CSDSF and CSDLF for clear sky downward solar and longwave flux - GRIB codes 161 and 163
- DSWRF and DLWRF for downard short and longwave radiation flux - GRIB codes 204 and 205

You'll need to figure that one out.

I used the following "ncrename" command to rename the variables before running this file through MET:
ncrename -v RAINRATE,PRATE -v PSFC,PRES -v V2D,VGRD -v U2D,UGRD -v Q2D,SPFH -v T2D,TMP out.nc out_for_MET.nc

Sorry for the rigid variable naming conventions.  As I mentioned, in future releases we hope to do a lot better job reading gridded NetCDF files.

Thanks,
John

David Gochis wrote:
> Thanks, John.  I'll wait to hear back from you later this week then.
> 
> -Dave
> 
> John Halley Gotway wrote:
>> Dave,
>>
>> Sorry I didn't get back to you sooner.  I've copied over your sample file
>> from scratch but haven't had any time to play around with it yet.
>>
>> I'm out of the office tomorrow, but I'll take a look on Thursday.
>>
>> We're trying to finish everything up for our upcoming release of MET next
>> week.
>>
>> As for times, MET is able to handle times down to the second.  Typically
>> though we're reading times from GRIB files.  But you raise a very good
>> point - when we read them from NetCDF files, we're actually expecting them
>> to be in hours.  We should probably read the accum_time_sec attribute
>> instead.  So I may need to make a minor tweak to our code, but it should
>> be doable.
>>
>> Thanks,
>> John
>>
>>   
>>> Hi John,
>>>
>>> We have created a new netcdf file in an 'intermediate' file format
>>> according to the emailed specs you sent.  It is on
>>> /scratch/hydrolab/out.nc.
>>> I was wondering if you could take a quick look at this file to assess
>>> its conformity for MET ingest.
>>>
>>> My main question is what variable name to use.  It looks like your
>>> code used GRIB_CODES to define these.  Thus I'm not sure
>>> what to use in our ncl conversion script.  Presently we set our rainfall
>>> variable to 'RAINRATE' but we could change this to a more appropriate
>>> name that MET will recognize.
>>>
>>> Also, much of our data is at 5 or 30min intervals while your sample
>>> used hours as a minimal time increment.  Is there some restriction
>>> in time resolution that we should be aware of?
>>>
>>> Thanks,
>>> Dave
>>>
>>>
>>> John Halley Gotway wrote:
>>>     
>>>> Dave,
>>>>
>>>> Unixtime is the number of seconds that have passed since January 1st,
>>>> 1970 (http://en.wikipedia.org/wiki/Unix_time).
>>>> It's just a convenient way of handling time information for software.
>>>> It makes adding and subtracting time very easy.
>>>>
>>>> Try running the "date" command with the %s option:
>>>> date +%s
>>>>
>>>> That'll give you the current unixtime.  The many options of the date
>>>> command can be used to convert to/from unixtime.  I'd guess there are
>>>> similar options for handling unixtime in NCL as well.
>>>>
>>>> As for local vs UTC time, I'd say that you could use either.  Just be
>>>> sure that the times for the forecast and observations are consistent.
>>>> All we really do with times for grid-to-grid comparisons is:
>>>> (1) warn you if you're comparing a forecast to an observation that have
>>>> different times
>>>> (2) write the times to the output files
>>>>
>>>> John
>>>>
>>>> David Gochis wrote:
>>>>
>>>>       
>>>>> John,
>>>>>
>>>>> Thanks a lot for this.  One quick question, and I apologize if the
>>>>> answer is in the documentation: by 'unix time' what does this mean?
>>>>> And does MET prefer all times converted to UTC as opposed to local
>>>>> times?
>>>>>
>>>>> Thanks again,
>>>>> Dave
>>>>>
>>>>> John Halley Gotway wrote:
>>>>>
>>>>>         
>>>>>> Dave,
>>>>>>
>>>>>> The attached NetCDF file is an example of NetCDF file that MET would
>>>>>> read containing precipitation accumulated over 12 hours.  Also this
>>>>>> example is on a Lambert Conformal grid.
>>>>>>
>>>>>> Listed below is the header for this file.  MET is expecting the
>>>>>> following:
>>>>>> (1) the name of the NetCDF variable = the GRIB code abbreviation for
>>>>>> that variable
>>>>>> (2) the variable attributes should include:
>>>>>>                 APCP_12:level = "SFC" ;
>>>>>>                 APCP_12:_FillValue = -9999.f ;
>>>>>>                 APCP_12:init_time_ut = 1123372800 ;
>>>>>>                 APCP_12:valid_time_ut = 1123416000 ;
>>>>>>                 APCP_12:accum_time = "12 hours" ;
>>>>>>                 APCP_12:accum_time_sec = 43200 ;
>>>>>>
>>>>>>                 The _ut means "unix time".
>>>>>>
>>>>>> (3) in the global attributes, the following define the Lambert
>>>>>> Conformal grid:
>>>>>>                 :Projection = "Lambert Conformal" ;
>>>>>>                 :p1_deg = "25.000000 degrees_north" ;
>>>>>>                 :p2_deg = "25.000000 degrees_north" ;
>>>>>>                 :p0_deg = "12.190000 degrees_north" ;
>>>>>>                 :l0_deg = "-133.459000 degrees_east" ;
>>>>>>                 :lcen_deg = "-95.000000 degrees_east" ;
>>>>>>                 :d_km = "40.635000 km" ;
>>>>>>                 :r_km = "6367.470000 km" ;
>>>>>>                 :nx = "185 grid_points" ;
>>>>>>                 :ny = "129 grid_points" ;
>>>>>>
>>>>>> Just let me know if you have any questions.  As I mentioned, we hope
>>>>>> to better support the NetCDF CF-convention in future releases.
>>>>>>
>>>>>> John
>>>>>>
>>>>>>
>>>>>> netcdf sample_fcst_12L_2005080712V_12A {
>>>>>> dimensions:
>>>>>>         lat = 129 ;
>>>>>>         lon = 185 ;
>>>>>> variables:
>>>>>>         float APCP_12(lat, lon) ;
>>>>>>                 APCP_12:grib_code = 61 ;
>>>>>>                 APCP_12:units = "kg/m^2" ;
>>>>>>                 APCP_12:long_name = "Total precipitation" ;
>>>>>>                 APCP_12:level = "SFC" ;
>>>>>>                 APCP_12:_FillValue = -9999.f ;
>>>>>>                 APCP_12:init_time = "20050807_000000" ;
>>>>>>                 APCP_12:init_time_ut = 1123372800 ;
>>>>>>                 APCP_12:valid_time = "20050807_120000" ;
>>>>>>                 APCP_12:valid_time_ut = 1123416000 ;
>>>>>>                 APCP_12:accum_time = "12 hours" ;
>>>>>>                 APCP_12:accum_time_sec = 43200 ;
>>>>>>
>>>>>> // global attributes:
>>>>>>                 :FileOrigins = "File
>>>>>> ../out/pcp_combine/sample_fcst_12L_2005080712V_12A.nc
>>>>>> generated 20090304_175559 UTC on host billiken by the
>>>>>> PCP-Combine tool" ;
>>>>>>                 :RunCommand = "Sum: Files from
>>>>>> ../data/sample_fcst/2005080700 with accumulations of 3
>>>>>> hours." ;
>>>>>>                 :Projection = "Lambert Conformal" ;
>>>>>>                 :p1_deg = "25.000000 degrees_north" ;
>>>>>>                 :p2_deg = "25.000000 degrees_north" ;
>>>>>>                 :p0_deg = "12.190000 degrees_north" ;
>>>>>>                 :l0_deg = "-133.459000 degrees_east" ;
>>>>>>                 :lcen_deg = "-95.000000 degrees_east" ;
>>>>>>                 :d_km = "40.635000 km" ;
>>>>>>                 :r_km = "6367.470000 km" ;
>>>>>>                 :nx = "185 grid_points" ;
>>>>>>                 :ny = "129 grid_points" ;
>>>>>>
>>>>>>
>>>>>>           
>>   
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mode_PRATE_SFC_vs_TMP_SFC_040000L_20020809_100000V_040000A.ps
Type: application/postscript
Size: 1449567 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/met_help/attachments/20090326/0311084e/attachment-0001.ps 


More information about the Met_help mailing list