Re: Problem extracting nc to txt

From: Ioannis Koletsis <koletsis_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 17 2013 - 06:19:09 MDT

Dear Dave,
thanks for your time...
I will try to use write_matrix....

John

-----Original Message-----
From: ncl-talk-bounces@ucar.edu [mailto:ncl-talk-bounces@ucar.edu] On Behalf
Of Dave Allured - NOAA Affiliate
Sent: Thursday, June 13, 2013 7:18 PM
To: Ioannis Koletsis
Cc: ncl-talk@ucar.edu
Subject: Re: Problem extracting nc to txt

John,

Inside four nested loops, you are building very long strings, by adding one
element at a time. This is extremely inefficient in NCL, because a copy of
every new long substring is permanently stored in program memory. So memory
consumption is order (2) for what should be an order (1) task. There is a
similar relation for CPU time to copy each long substring length(m) to the
next longer substring length(m+7). You can get away with this method for
small arrays, but it bogs down for larger arrays.

Try reshaping the 4-D numeric input array to a 2-D numeric output array.
Include extra columns for your index columns, lat and lon.
Then output the 2-D numeric array to a text file using write_matrix, which
has the desired format control.

--Dave

On Thu, Jun 13, 2013 at 7:14 AM, Ioannis Koletsis <koletsis@noa.gr> wrote:
> Dear ncl-users,
>
> I would like to extract from .nc file in a txt file with the lat, lon,
> ws format for each grid point, the wind speed values for a specific
domain.
>
> Firstly, I tried to extract in to a txt file using the attached script
> (ex_alldata_Med_HH_3.ncl), but the script has been stuck and finally
> killed.
>
> I had had the same results with the simply script (dimbin3.ncl).
>
> Secondly, I tried to extract my file into a binary file (script2:
> dimbin2.ncl), and everything was ok
>
> Have you got any idea what is going wrong with the first script???
>
> The source file for free downloading is available here..
>
> http://ensemblesrt3.dmi.dk/data/A2/C4I/DM/
>
>
>
> Any help would be appreciated
>
>
>
> John
>
>
>
>
>
> Dr. Ioannis Koletsis
>
> National Observatory of Athens
> Institute for Environmental Research
> Lofos Koufou
> 15236-Penteli
> Athens-Greece
> Tel: +30 210 8109203, Fax: +30 210 8103236
> e-mail: koletsis@meteo.noa.gr
>
> ----------------------------------------------------------------------
> ------------------ Weather forecasts: http://www.noa.gr/forecast (in
> english) or http://www.meteo.gr (in greek) Weather forecasts for
> Europe: http://www.eurometeo.gr (in english)
>
> ----------------------------------------------------------------------
> ------------------
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2013.0.2904 / Virus Database: 3199/6407 - Release Date: 06/13/13

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 17 06:18:51 2013

This archive was generated by hypermail 2.1.8 : Mon Jun 24 2013 - 11:46:47 MDT