[ncl-talk] Write the input variables on an ASCII file

Rick Brownrigg brownrig at ucar.edu
Mon Jun 3 21:02:43 MDT 2019


Hi Lara,

There are a number of approaches, and not knowing the specifics, its hard
to know how to advise best:

- if "print"ing is otherwise working for you, and there are no other
superfluous print statements in the script, perhaps something like "ncl -Q
myscript.ncl >myAsciiFile.txt"   (The -Q suppresses the printing of the
version and copyright info).

- Alternatively, create a NetCDF file from the GRIB file, and then use
ncdump or some other NetCDF tool to dump the contents. Creating NetCDF from
NCL is pretty easy:

    http://ncl.ucar.edu/Applications/list_io.shtml

- Finally, if the files are fairly large in binary form, they will of
course be considerably larger in ASCII form:  i) NCL's string handling in
the face of large amounts of string data is notoriously bad, ii) reading
large amounts of ASCII data can be slow, iii) is there a good reason to
prefer ASCII over, say, NetCDF (its an honest question -- if the answer is
"yes", then yes!).

Hope that helps...
Rick

On Mon, Jun 3, 2019 at 5:29 AM Lara Quitián Hernández <
laraquitianhernandez at gmail.com> wrote:

> Hi,
>
> I have just verified it. I have all permits on that directory: drwxrwxrwx
>
> I will continue working on it.
>
> Thanks a lot.
>
> Best regards,
> Lara
>
> El lun., 3 jun. 2019 a las 13:23, Lyndz (<olagueralyndonmark429 at gmail.com>)
> escribió:
>
>> Hi,
>>
>> Maybe yes (that it is related to the memory issue of your PC) or it could
>> be something else. Check if you have a write access to the grib files or
>> the location where you are saving the text files.
>>
>> ---
>> Lyndz
>>
>>
>>
>>
>> On Mon, Jun 3, 2019 at 7:32 PM Lara Quitián Hernández <
>> laraquitianhernandez at gmail.com> wrote:
>>
>>> Hi!
>>>
>>> I did not know that command! Thanks a lot. But I'm afraid I have another
>>> problem. I received this error message: "Segmentation fault (core dumped)".
>>> It seems to be a memory problem. What should I do?
>>> Each file has a 223MB size. It isn't so much, isn't it?
>>>
>>> Best regards,
>>> Lara
>>>
>>> El lun., 3 jun. 2019 a las 11:57, Lyndz (<
>>> olagueralyndonmark429 at gmail.com>) escribió:
>>>
>>>> Hi,
>>>>
>>>> If I got your question correctly, I think you dont need to read the
>>>> file.
>>>>
>>>> ncl_filedump PFHARMOPHELIA+0084.grib  >  PFHARMOPHELIA+0084.txt
>>>>
>>>> -----
>>>>
>>>> Lyndz
>>>>
>>>> On Mon, Jun 3, 2019 at 4:53 PM Lara Quitián Hernández <
>>>> laraquitianhernandez at gmail.com> wrote:
>>>>
>>>>> Good morning,
>>>>>
>>>>> I'm working with a specific model output file (grib format). I would
>>>>> like to write all the available variables of my input file on an ASCII
>>>>> file. Could you please help me with the function that does that?
>>>>>
>>>>> I'm now using the print() function but it would be easier to have the
>>>>> ASCII file saved on my computer.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> *; read file;************************************************file =
>>>>> addfile("../PFHARMOPHELIA+0084.grib", "r")print(file)*
>>>>>
>>>>> Thanks in advance.
>>>>> Best regards
>>>>>
>>>>> Lara
>>>>>
>>>>> --
>>>>>
>>>>>
>>>>> *Lara Quitián Hernández, PhD Student*
>>>>> Department of Earth Physics and Astrophysics
>>>>> Faculty of Physical Sciences
>>>>> Ciudad Universitaria, Plaza Ciencias, 1
>>>>> 28040 Madrid. Spain
>>>>> Email: lquitian at ucm.es <mlunar at aemet.es>
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>
>>>
>>> --
>>>
>>>
>>> *Lara Quitián Hernández, PhD Student*
>>> Department of Earth Physics and Astrophysics
>>> Faculty of Physical Sciences
>>> Ciudad Universitaria, Plaza Ciencias, 1
>>> 28040 Madrid. Spain
>>> Email: lquitian at ucm.es <mlunar at aemet.es>
>>>
>>>
>
> --
>
>
> *Lara Quitián Hernández, PhD Student*
> Department of Earth Physics and Astrophysics
> Faculty of Physical Sciences
> Ciudad Universitaria, Plaza Ciencias, 1
> 28040 Madrid. Spain
> Email: lquitian at ucm.es <mlunar at aemet.es>
>
> _______________________________________________
> 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/20190603/e286f935/attachment.html>


More information about the ncl-talk mailing list