[ncl-talk] Read multiple nc files

Karin Meier-Fleischer meier-fleischer at dkrz.de
Fri Dec 22 07:59:20 MST 2017


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.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
>    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]
>    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 <mailto: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
>>
>> -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.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 list
>>> ncl-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
>> Fax:      +49 (0)40 460094 270
>> 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 <mailto: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/20171222/812c1c88/attachment.html>


More information about the ncl-talk mailing list