[ncl-talk] problems about converting ASCII to nc and plotting thenc file

Dennis Shea shea at ucar.edu
Mon Oct 6 08:12:58 MDT 2014


There is no '"tricky way to convert multiple ascii files to nc files"

Please see:
https://www.ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml

to get all desired file names ... then loop over files.

A minor change to previous script is needed.

attached [ uses := reassignment syntax available in v6.1.1; ... otherwise
delete variable
at the end of each iteration]

On Sat, Oct 4, 2014 at 8:49 AM, Li Qi <liqi123sh at qq.com> wrote:

> very nice script and nicely explained...
>
> Thank you very much!
>
> By the way: Is there any tricky way to convert multiple ascii files to nc
> files?
>
> Attached are the data.
>
>
> ------------------ 原始邮件 ------------------
> *发件人:* "Dennis Shea";<shea at ucar.edu>;
> *发送时间:* 2014年10月4日(星期六) 晚上9:33
> *收件人:* "Li Qi"<liqi123sh at qq.com>;
> *抄送:* "ncl-talk"<ncl-talk at ucar.edu>;
> *主题:* Re: [ncl-talk] problems about converting ASCII to nc and plotting
> thenc file
>
> [1] lat, lon, rain are all one-dimensional (1D)
> [2] You are setting
>
>      rain at lat2d = lat
>      rain at lon2d= lon
>
>     The reserved attributes @lat2d and @lon2d require two-dimensional
> arrays.
>     That is what the 2d means.
>
> [3] You do not need to create a netCDF file for plotting.
>       You can read the ascii and plot
>
> See attached.
>
> --
> Responses to ncl-talk only. Please no personal salutation.
>
> On Sat, Oct 4, 2014 at 2:14 AM, Li Qi <liqi123sh at qq.com> wrote:
>
>> Dear NCL,
>>
>> I have an ASCII file having dimensions [lon,lat],
>>
>> then I'd like to convert it to nc file and plot it.
>>
>> Attached please find the data and scripts.
>>
>> However, when I plot it, I got error warnings and no contours appeared on
>> the map.
>>
>> (0)     Error: scalar_field: If the input data is 1-dimensional, you must
>> set sfXArray and sfYArray to 1-dimensional arrays of the same length.
>> warning:create: Bad HLU id passed to create, ignoring it
>> warning:ContourPlotSetValues: Data values out of range of levels set by
>> EXPLICITLEVELS mode
>>
>> Could you please to help me?
>>
>> Any advice will be greatly appreciated!
>>
>> Best,
>>
>> LI Qi‍
>>
>> _______________________________________________
>> ncl-talk mailing list
>> 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/20141006/ec6d2e2a/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ascii2plot.ncl_v1
Type: application/octet-stream
Size: 5493 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141006/ec6d2e2a/attachment.obj 


More information about the ncl-talk mailing list