[ncl-talk] killed occurence
Ehsan Taghizadeh
ehsantaghizadeh at yahoo.com
Wed Dec 20 12:46:41 MST 2017
Dear MaryThank you so much for your help. As you suggested I attached input files (GPM_IMERGV04DL_20170401_20170430.rar) and script file (GPM_Interpolating.rar). The script works well until first, but it goes slow gradually and finally it killed.About your following comment: write_table("file2.txt","w",[/j,x,i,y,k/], "string_%03i %8.2f %4.0i %8.1f string_%03i")About I think it isn't possible for me, because of different indexes of variables:
write_table("GPM_R24_Grid.txt","a",[/GPM_fnamesc(i),lat_GPM(j),lon_GPM(k), R24h_GPM(k,j)/], " %s %7.4f %7.4f %5.1f").
SincerelyEhsan Taghizadeh On Tuesday, December 19, 2017, 8:10:12 PM GMT+3:30, Mary Haley <haley at ucar.edu> wrote:
Dear Ehsan,
If you are asking us to look at your script and improve it for you, it helps to provide more details about what you expect the script to do and where it appears to be failing.
You included the script and some of the files, but not the NetCDF files, so there's no way for us to actually run the script to see what the problem is.
Did you try debugging your script to see where it might be failing? It would help to add more print statements, especially at the top of the do loops, so you can see how many iterations of the loops it completes before it fails.
Nested do loops shouldn't cause your script to fail, but they could cause your script to be much slower than needed.
I see that you are trying to write data to a file called "GPM_R24_Grid.txt" and that you have a double do loop for writing individual rows to the file. You can write more than one row of data to the file without having to loop across each value, and this could greatly improve the speed of your script.
Here's a very simple example:
;---Generate some dummy integer and float data. npts = 100 i = ispan(1,npts,1) j = generate_unique_indices(npts) k = generate_unique_indices(npts) x = random_uniform(-10,10,npts) y = random_uniform(0,1000.,npts)
write_table("file2.txt","w",[/j,x,i,y,k/], "string_%03i %8.2f %4.0i %8.1f string_%03i")
For more examples of using write_table to write multiple lines of text to an ASCII file, see this examples page:
http://www.ncl.ucar.edu/Applications/write_csv.shtml
This page is for writing CSV files, but these examples can be used for any kind of ASCII file.
If you continue to have problems with your script, please respond back to ncl-talk at ucar.edu and provide more information, like where you think the script is failing, and what you are trying to accomplish with it.
Thanks,
--Mary
On Tue, Dec 19, 2017 at 1:56 AM, Ehsan Taghizadeh via ncl-talk <ncl-talk at ucar.edu> wrote:
Hi,I try to run attached script (main.nc), however each time it counters killed, without any error.I've searched google for that and it seems because of nested loops. Is it true? Could you please help to make this script more efficient? Also I attached some part of printVarSummary.
SincerelyEhsan
______________________________ _________________
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/20171220/26a6806b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GPM_IMERGV04DL_20170401_20170430.rar
Type: application/octet-stream
Size: 187590 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171220/26a6806b/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GPM_Interpolating.rar
Type: application/octet-stream
Size: 5142 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171220/26a6806b/attachment-0001.obj>
More information about the ncl-talk
mailing list