[ncl-talk] modifying header info in a netcdf file

Dennis Shea shea at ucar.edu
Fri Jun 7 12:05:37 MDT 2019


In my opinion, it is unfortunate that many NASA HDF-[4/5] files do not
include a 'time' dimension ... even if it is a "degenerate" dimension
[size=1].
Time is often included in the file name or as string/character variables
within the file attributes. To my knowledge, there is no NASA standard for
how this is done.
===
I would suggest looking at the netCDF operators [NCO: eg: *ncks*] or the
Climate Data Operators [CDO]. The issue is that the date information for
many NASA files are specific to a particular experiment/satellite.
===
Again: In my opinion a*dding a dimension named 'time' but not including
what the time value is .... will not solve the problem*. The time 'value'
must be included.

===
NCL can do what is desired BUT a user must create an NCL script. This will
create a new file.
The attached is based on an ncl-talk response on 12/07/2017. It uses
*addfiles* because you stated that you have mutiple netCDF files. For
illustration, only one variable is used.

Good Luck
D





On Fri, Jun 7, 2019 at 9:59 AM Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi,
>
> From the file dump, I don't see where any of the variables incorporate a
> time dimension, so its not clear what would be the value of adding a time
> dimension to the file?
>
> Rick
>
> On Fri, Jun 7, 2019 at 8:57 AM Manisha Ganeshan <
> manisha.ganeshan86 at gmail.com> wrote:
>
>> Here's the output from ncl_filedump.
>>
>> Variable: f
>>
>> Type: file
>>
>> filename:       3B-DAY-L.MS.MRG.3IMERG.20190222-S000000-E235959.V05
>>
>> path:   3B-DAY-L.MS.MRG.3IMERG.20190222-S000000-E235959.V05.nc4
>>
>> attributes:
>>
>>     BeginDate   :       2019-02-22
>>
>>     BeginTime   :       00:00:00.000Z
>>
>>     EndDate     :       2019-02-22
>>
>>     EndTime     :       23:59:59.999Z
>>
>>     FileHeader  :       StartGranuleDateTime=2019-02-22T00:00:00.000Z;
>>
>> StopGranuleDateTime=2019-02-22T23:59:59.999Z
>>
>>     InputPointer        :
>> 3B-HHR-L.MS.MRG.3IMERG.20190222-S000000-E002959.0000.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S003000-E005959.0030.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S010000-E012959.0060.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S013000-E015959.0090.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S020000-E022959.0120.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S023000-E025959.0150.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S030000-E032959.0180.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S033000-E035959.0210.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S040000-E042959.0240.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S043000-E045959.0270.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S050000-E052959.0300.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S053000-E055959.0330.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S060000-E062959.0360.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S063000-E065959.0390.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S070000-E072959.0420.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S073000-E075959.0450.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S080000-E082959.0480.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S083000-E085959.0510.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S090000-E092959.0540.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S093000-E095959.0570.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S100000-E102959.0600.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S103000-E105959.0630.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S110000-E112959.0660.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S113000-E115959.0690.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S120000-E122959.0720.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S123000-E125959.0750.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S130000-E132959.0780.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S133000-E135959.0810.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S140000-E142959.0840.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S143000-E145959.0870.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S150000-E152959.0900.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S153000-E155959.0930.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S160000-E162959.0960.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S163000-E165959.0990.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S170000-E172959.1020.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S173000-E175959.1050.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S180000-E182959.1080.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S183000-E185959.1110.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S190000-E192959.1140.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S193000-E195959.1170.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S200000-E202959.1200.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S203000-E205959.1230.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S210000-E212959.1260.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S213000-E215959.1290.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S220000-E222959.1320.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S223000-E225959.1350.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S230000-E232959.1380.V05B.HDF5;3B-HHR-L.MS.MRG.3IMERG.20190222-S233000-E235959.1410.V05B.HDF5
>>
>>     title       :       GPM Level 3 IMERG Late Daily 0.1 x 0.1 degree
>> Precipitation
>>
>>     ProductionTime      :       2019-02-23T13:46:08.485Z
>>
>>
>> dimensions:
>>
>>     lon = 3600
>>
>>     lat = 1800
>>
>>
>> chunk dimensions:
>>
>>     lon = 3600
>>
>>     lat = 900
>>
>>
>> variables:
>>
>>     precipitationCal: <float>   [ 3600 <lon>, 1800 <lat> ]
>>
>>         Chunking Info:  [ 3600 <lon>, 900 <lat> ]
>>
>>         attributes:
>>
>>             units       :       mm
>>
>>             long_name   :       Daily accumulated precipitation
>> (combined microwave-IR) estimate
>>
>>             coordinates :       lat lon
>>
>>             _FillValue  :       -9999.900391
>>
>>
>>     precipitationCal_cnt: <byte>        [ 3600 <lon>, 1800 <lat> ]
>>
>>         Chunking Info:  [ 3600 <lon>, 900 <lat> ]
>>
>>         attributes:
>>
>>             units       :       count
>>
>>             long_name   :       Count of valid half-hourly
>> precipitationCal retrievals for the day
>>
>>             coordinates :       lat lon
>>
>>
>> HQprecipitation: <float>    [ 3600 <lon>, 1800 <lat> ]
>>
>>         Chunking Info:  [ 3600 <lon>, 900 <lat> ]
>>
>>         attributes:
>>
>>             units       :       mm
>>
>>             long_name   :       Daily accumulated High Quality
>> precipitation from all available MW sources
>>
>>             coordinates :       lat lon
>>
>>             _FillValue  :       -9999.900391
>>
>>
>>     HQprecipitation_cnt: <byte> [ 3600 <lon>, 1800 <lat> ]
>>
>>         Chunking Info:  [ 3600 <lon>, 900 <lat> ]
>>
>>         attributes:
>>
>>             units       :       count
>>
>>             long_name   :       Count of valid half-hourly
>> HQprecipitation retrievals for the day
>>
>>             coordinates :       lat lon
>>
>>
>>     randomError: <float>        [ 3600 <lon>, 1800 <lat> ]
>>
>>         Chunking Info:  [ 3600 <lon>, 900 <lat> ]
>>
>>         attributes:
>>
>>             units       :       mm
>>
>>             long_name   :       Daily total error of precipitation
>> estimate
>>
>>             coordinates :       lat lon
>>
>>             _FillValue  :       -9999.900391
>>
>>
>>     randomError_cnt: <byte>     [ 3600 <lon>, 1800 <lat> ]
>>
>>         Chunking Info:  [ 3600 <lon>, 900 <lat> ]
>>
>>         attributes:
>>
>>             units       :       count
>>
>>             long_name   :       Count of valid half-hourly randomError
>> retrievals for the day
>>
>>             coordinates :       lat lon
>>
>>
>>     lon: <float>        [ 3600 <lon> ]
>>
>>         attributes:
>>
>>             units       :       degrees_east
>>
>>             long_name   :       Longitude
>>
>>
>>     lat: <float>        [ 1800 <lat> ]
>>
>>         attributes:
>>
>>             units       :       degrees_north
>>
>>             long_name   :       Latitude
>>
>> On Fri, Jun 7, 2019 at 10:33 AM Manisha Ganeshan <
>> manisha.ganeshan86 at gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I have netcdf files with incomplete information in the header.
>>> It has latitude and longitude, but is missing the time dimension.
>>> I'm wondering if there's an quick way to modify just the header of a
>>> netcdf file to add *time = xxx *under dimensions?
>>> I don't want to modify anything else.
>>>
>>> Regards,
>>> Nisha
>>> --
>>> Dr. Manisha Ganeshan
>>> Universities Space Research Association
>>> Maryland, U.S.A.
>>>
>>
>>
>> --
>> Dr. Manisha Ganeshan
>> Universities Space Research Association
>> Maryland, U.S.A.
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190607/28b850ac/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3B-DAY.ncl
Type: application/octet-stream
Size: 2722 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190607/28b850ac/attachment.obj>


More information about the ncl-talk mailing list