[ncl-talk] grib2 to netcdf

Md. Jalal Uddin dmjalal90 at gmail.com
Mon Apr 13 18:21:18 MDT 2020


Thank you, sir. It is working now.

On Sun, 12 Apr 2020 at 21:47, Rick Brownrigg <brownrig at ucar.edu> wrote:

> HI,
>
> addfiles() returns a *list* of filevars, whereas getfilevarnames expects a
> filevar. If you know all the files to be uniform in structure, you could
> simple pick one of them, say the first, to get the names:
>
>     names = getfilevarnames(f[0])
>
> Also, see the docs for addfiles():
>
> http://ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
>
> It has this advice:
>
>
>    - 1. Whereas *addfile*
>    <http://ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml>
>    returns a reference to a single file in a variable of type *file*,
>    *addfiles* returns a variable of type *list* that contains references,
>    each of type *file*, to multiple files. This combination of the *list*
>    and *file* types forms a specialized *list* type. It provides a means
>    of obtaining the aggregated contents of variables that span the complete
>    list of files.
>
>    - 2. It is not yet possible to use the file *list* type variable as
>    input to the "getfile*xxxx*" suite of functions. However, since each
>    element of the *list* is actually a *file* type variable, you can
>    input a single element of the *list* as an argument to any of these
>    functions, e.g.:
>
>      files = *systemfunc* <http://ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml>("ls *.nc")
>      f = *addfiles*(files,"r")
>      dsizes = *getfiledimsizes* <http://ncl.ucar.edu/Document/Functions/Built-in/getfiledimsizes.shtml>(f[0])
>
>    -
>    -
>
>    Rick
>
>
>
> On Sun, Apr 12, 2020 at 6:54 AM Md. Jalal Uddin via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Hi all,
>>
>> I hope that you are all well.
>>
>> I am trying to convert grib2 into netcdf. The problem is to use many
>> files together. If I use only one file, it is working fine.
>>
>> I have tried to use addfiles function here.
>>
>>   diri = "./"
>>    fili = systemfunc("cd "+diri+" ; ls 20180709_0000f*.grib2")
>>    f    = addfiles(diri+fili,"r")
>>
>>    names   = getfilevarnames(f)
>>
>> print(names)
>>
>>
>> *fatal:*Argument type mismatch on argument (0) of (getfilevarnames) can
>> not coerce
>>
>> Any suggestions would be appreciated. The code has been added herewith.
>>
>> Best wishes,
>> Jalal
>> --
>> *Md. Jalal Uddin*
>> M.Sc. in Applied Meteorology
>> Nanjing University of Information, Science and Technology, China.
>> B.Sc. in Disaster Management (Hons.)
>> Patuakhali Science and Technology University, Bangladesh.
>> Cell: +8613260859092, +8801792052662
>> Web: www.dmjalal90.weebly.com
>> Researchgate: https://www.researchgate.net/profile/Md_Uddin125
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

-- 
*Md. Jalal Uddin*
M.Sc. in Applied Meteorology
Nanjing University of Information, Science and Technology, China.
B.Sc. in Disaster Management (Hons.)
Patuakhali Science and Technology University, Bangladesh.
Cell: +8613260859092, +8801792052662
Web: www.dmjalal90.weebly.com
Researchgate: https://www.researchgate.net/profile/Md_Uddin125
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20200414/581c9f4e/attachment.html>


More information about the ncl-talk mailing list