[ncl-talk] Read multiple nc files

Dennis Shea shea at ucar.edu
Wed Dec 27 18:52:15 MST 2017


What version of NCL are you using?

*Always* include that in a new thread.

%> ncl -V

===============
grib (grib-1, grib-2), netCDF (netCDF-3, netCDF-4), HDF-4/5-EOS, HDF5

***It does not matter.***

 NCL's *addfiles* can read one or more in any of these formats.

https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml

===
NCL has been used to read terabytes of ERA-I, NCEP and MERRA data ...

Typically, MERRA2 files have a suffix of .nc4

NCL reads these without a problem.

MERRA:%> *ncl_filedump *MERRA2_400.tavg1_2d_slv_Nx.20140101.*nc4*

[snip]
    Filename    :     MERRA2_400.tavg1_2d_slv_Nx.20140101.nc4
    Conventions    :     CF-1
    Institution    :     NASA Global Modeling and Assimilation Office
    References    :     http://gmao.gsfc.nasa.gov
    Format    :     NetCDF-4/HDF-5
[snip]

===
*addfile/addfiles* look at the file extension. Your file has and extension
of:  *.nc*
MERRA2_200.tavgM_3d_cld_Np.199902.nc4.nc

However, the above file is a netCDF-4 file.

Who/What added the extra *.nc* ?


Cheers


On Sat, Dec 23, 2017 at 8:53 PM, Wang Xinyue via ncl-talk <ncl-talk at ucar.edu
> wrote:

> Hi
>
> I downloaded ERA-I data directly in nc format.
>
> Yes you are right, I can use addfiles to read some nc data, such as NECP
> nc data.
> However, when I use the same commands to read ERA-I data and MERRA2 data,
> it doesn’t work. I do not know why.
>
> Best regards,
> Xinyue
>
> On Dec 24, 2017, at 12:49, Krishnamoorthy Chandramouli <
> chandrakrishna.90 at gmail.com> wrote:
>
> Hi
>
> From your error message it looks like you want to read ERA data
>
> I think ERA interim data is in grib format.
>
> I used to convert it to netcdf using ncl_convert2nc
>
> then i read the file.
>
> If you want to read nc4 file. you can do it directly using addfile.
>
> I have read the nc4 IMERG data recently, i never encountered a problem.
>
>
>
> *Regards,*
> *Krishnamoorthy Chandramouli*
>
> On Sun, Dec 24, 2017 at 9:06 AM, Wang Xinyue via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Hi Karin,
>>
>> Thanks for the reply.
>> However, it did not work, I got the same warning:
>> <PastedGraphic-3.png>
>>
>> On Dec 22, 2017, at 23:59, Karin Meier-Fleischer <meier-fleischer at dkrz.de>
>> wrote:
>>
>> Try:
>>
>> fils = systemfunc("ls *.nc")
>> setfileoption("nc", "FileStructure", "Advanced")
>> f = addfiles(fils,"r")
>>
>> -Karin
>>
>> Am 22.12.17 um 12:20 schrieb Wang Xinyue:
>>
>> Hi Karin,
>>
>> Thanks for your prompt reply!
>> The 199902 dataset is just one of the datasets I want to read, I selected
>> that one randomly and every single dataset got the same warning as:
>>
>> warning:_NclOpenFile: Can not open file </.../.../merra2/MERRA2_200.ta
>> vgM_3d_cld_Np.199902.nc4.nc
>> <http://merra2_200.tavgm_3d_cld_np.199902.nc4.nc/>>; file format not
>> supported or file is corrupted
>>
>>
>>
>> The ncl_filedump output is like this:
>>
>> Variable: f
>> Type: file
>> filename: MERRA2_400.tavgM_3d_cld_Np.201112.nc4
>> path: /.../MERRA2_400.tavgM_3d_cld_Np.201112.nc4.nc
>> <http://merra2_400.tavgm_3d_cld_np.201112.nc4.nc/>
>>    file global attributes:
>>       History : Original file generated: Sat Jul  4 21:58:25 2015 GMT
>>       Filename : MERRA2_400.tavgM_3d_cld_Np.201112.nc4
>>       Comment : GMAO filename: d5124_m2_jan10.tavg3_3d_cld_Np
>> .monthly.201112.nc4
>>       Conventions : CF-1
>>       Institution : NASA Global Modeling and Assimilation Office
>>       References : http://gmao.gsfc.nasa.gov
>>       Format : NetCDF-4/HDF-5
>>       SpatialCoverage : global
>>       VersionID : 5.12.4
>>       TemporalRange : 1980-01-01 -> 2016-12-31
>>       identifier_product_doi_authority : http://dx.doi.org/
>>       ShortName : M2TMNPCLD
>>       RangeBeginningDate : 2011-12-01
>>       RangeEndingDate : 2011-12-31
>>       GranuleID : MERRA2_400.tavgM_3d_cld_Np.201112.nc4
>>       ProductionDateTime : Original file generated: Sat Jul  4 21:58:25
>> 2015 GMT
>>       LongName : MERRA2 tavg3_3d_cld_Np: 3d,3-Hourly,Time-Averaged,Pressure-Level,Assimilation,Cloud
>> Diagnostics Monthly Mean
>>       Title : MERRA2 tavg3_3d_cld_Np: 3d,3-Hourly,Time-Averaged,Pressure-Level,Assimilation,Cloud
>> Diagnostics Monthly Mean
>>       SouthernmostLatitude : -90.0
>>       NorthernmostLatitude : 90.0
>>       WesternmostLongitude : -180.0
>>       EasternmostLongitude : 179.375
>>       LatitudeResolution : 0.5
>>       LongitudeResolution : 0.625
>>       DataResolution : 0.5 x 0.625 (42 pressure levels)
>>       Source : CVS tag: GEOSadas-5_12_4
>>       Contact : http://gmao.gsfc.nasa.gov
>>       identifier_product_doi : 10.5067/J9R0LXGH48JR
>>       RangeBeginningTime : 00:00:00.000000
>>       RangeEndingTime : 23:59:59.000000
>>       DODS_EXTRA.Unlimited_Dimension : time
>>       history : 2017-12-10 06:40:28 GMT Hyrax-1.13.4
>> https://goldsmr5.gesdisc.eosdis.nasa.gov:443/opendap/MERRA2_
>> MONTHLY/M2TMNPCLD.5.12.4/2011/MERRA2_400.tavgM_3d_cld_Np.
>> 201112.nc4.nc?CLOUD[0:0][0:41][0:360][0:575],time,lev,lat[0:
>> 360],lon[0:575
>> <https://goldsmr5.gesdisc.eosdis.nasa.gov/opendap/MERRA2_MONTHLY/M2TMNPCLD.5.12.4/2011/MERRA2_400.tavgM_3d_cld_Np.201112.nc4.nc?CLOUD[0:0][0:41][0:360][0:575],time,lev,lat[0:360],lon[0:575>
>> ]
>>    dimensions:
>>       time = 1
>>       lev = 42
>>       lat = 361
>>       lon = 576
>>    variables:
>>       float CLOUD ( time, lev, lat, lon )
>>          long_name : cloud_fraction_for_radiation
>>          units : 1
>>          _FillValue : 1e+15
>>          missing_value : 1e+15
>>          fmissing_value : 1e+15
>>          vmax : 1e+15
>>          vmin : -1e+15
>>          valid_range : ( -1e+15, 1e+15 )
>>          origname : CLOUD
>>          fullnamepath : /CLOUD
>>
>>       double lat ( lat )
>>          CLASS : DIMENSION_SCALE
>>          NAME : lat
>>          long_name : latitude
>>          units : degrees_north
>>          vmax : 1e+15
>>          vmin : -1e+15
>>          valid_range : ( -1e+15, 1e+15 )
>>          origname : lat
>>          fullnamepath : /lat
>>
>>       double lev ( lev )
>>          CLASS : DIMENSION_SCALE
>>          NAME : lev
>>          long_name : vertical level
>>          units : hPa
>>          positive : down
>>          vmax : 1e+15
>>          vmin : -1e+15
>>          valid_range : ( -1e+15, 1e+15 )
>>          origname : lev
>>          fullnamepath : /lev
>>
>>       double lon ( lon )
>>          CLASS : DIMENSION_SCALE
>>          NAME : lon
>>          long_name : longitude
>>          units : degrees_east
>>          vmax : 1e+15
>>          vmin : -1e+15
>>          valid_range : ( -1e+15, 1e+15 )
>>          origname : lon
>>          fullnamepath : /lon
>>
>>       integer time ( time )
>>          CLASS : DIMENSION_SCALE
>>          NAME : time
>>          long_name : time
>>          units : minutes since 2011-12-01 01:30:00
>>          time_increment : 60000
>>          begin_date : 20111201
>>          begin_time : 13000
>>          vmax : 1e+15
>>          vmin : -1e+15
>>          valid_range : ( -1e+15, 1e+15 )
>>          origname : time
>>          fullnamepath : /time
>> Thanks,
>> Xinyue
>>
>> On Dec 22, 2017, at 19:16, Karin Meier-Fleischer via ncl-talk <
>> ncl-talk at ucar.edu> wrote:
>>
>> Hi Xinyue,
>>
>> please, send the output of *ncl_filedump* from
>> MERRA2_200.tavgM_3d_cld_Np.199902.nc4.nc
>> <http://merra2_200.tavgm_3d_cld_np.199902.nc4.nc/>
>>
>> -Karin
>>
>>
>> Am 22.12.17 um 10:16 schrieb Wang Xinyue via ncl-talk:
>>
>> Hi there,
>>
>> I met with a problem in reading nc files.
>> I can use the following commands to read NCEP datasets:
>>
>> fils = systemfunc("ls /.../.../ncep/omega/*.nc”)
>> f = addfiles(fils, "r”)
>>
>> But when I use the same commands to read ERA-I datasets and MERRA2
>> datasets, it warned like this:
>>
>> warning:_NclOpenFile: Can not open file </.../.../merra2/MERRA2_200.ta
>> vgM_3d_cld_Np.199902.nc4.nc
>> <http://merra2_200.tavgm_3d_cld_np.199902.nc4.nc/>>; file format not
>> supported or file is corrupted
>>
>> Is anyone there had similar experience before? And how did you fix it?
>>
>> Looking forward to your reply.
>>
>> Thanks,
>> Xinyue
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing listncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>> --
>> Dipl. Geophys. Karin Meier-Fleischer
>> Visualization, NCL, CDO
>> Application Support
>>
>> Deutsches Klimarechenzentrum GmbH (DKRZ)
>> Bundesstrasse 45a - D20146 Hamburg - Germany
>>
>> Phone:    +49 (0)40 460094 126 <+49%2040%20460094126>
>> Fax:      +49 (0)40 460094 270 <+49%2040%20460094270>
>> E-Mail:   meier-fleischer at dkrz.de
>> URL:      www.dkrz.de
>>
>> Geschäftsführer: Prof. Dr. Thomas Ludwig
>> Sitz der Gesellschaft: Hamburg
>> Amtsgericht Hamburg HRB 39784
>>
>> _______________________________________________
>> 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
>>
>>
>
>
> _______________________________________________
> 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/20171227/397848bc/attachment.html>


More information about the ncl-talk mailing list