<div dir="ltr">Hello Mirce:<div><br></div><div>Is there some number of loops that the program will pass through without giving a segmentation fault? If so, it may mean that you are running out of memory.</div><div><br></div><div>Or, you could find the loop it crashes in and see if you can just run that loop by itself. Or, perhaps, you can run other loops around it, but not that one indicating a data problem.</div><div><br></div><div>Just some things to check before trying to figure out if the program itself is broken.</div><div><br></div><div>Barry</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 19, 2018 at 2:14 AM Mirce Morales <<a href="mailto:mirce.morales@gmail.com">mirce.morales@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi all,<div><br></div><div>I am trying to do regrid many variables on ERA5 data using the script below. Each file contains many times in it, so I am looping through the time and the variables to apply bilinear interpolation. However, my script is failing in the time loop. </div><div><br></div><div>I tested it without going into the time loop by just defining t = 1, and everything worked well...however when I run all my script it crashes....This is the error I am getting:</div><div><br></div><div><i><b>Segmentation fault (core dumped)</b></i><br></div><div><br></div><div>My script:</div><div>;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::</div><div><br></div><div><div><i>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</i></div><div><i>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</i></div><div><i>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</i></div><div><i>load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl"</i></div><div><i>load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"</i></div><div><i><br></i></div><div><i>begin</i></div><div><i>;----------------------------------------------------------------------<br></i></div><div><i>; User settings</i></div><div><i>;----------------------------------------------------------------------</i></div><div><i> ;---------------------------------------------------------------;<br></i></div><div><i> ; Set the domain number to agree with the geogrid file and ;</i></div><div><i> ; the IGRID option in the hydro.namelist for WRF-Hydro ;</i></div><div><i> ;---------------------------------------------------------------;</i></div><div><i> domain = "DOMAIN1"</i></div><div><i> ;---------------------------------------------------------------;<br></i></div><div><i> ; Set input and output file directories. ;</i></div><div><i> ;---------------------------------------------------------------;</i></div><div><i> dirm = "/glade/scratch/mirce/LaSierra/FullDomainForcing/ERA5/" ; directory where source forcing data resides</i></div><div><i> outdir = "./output_regriddes_files/" ; directory where regridded forcing data will be placed. set to dirm for overwriting the original file</i></div><div><i> ;---------------------------------------------------------------;<br></i></div><div><i> ; Set a variable to indicate the timestep of source data ;</i></div><div><i> ;---------------------------------------------------------------;</i></div><div><i> dt=3600.0 ; time over which precipitation is accumulated in the source dataset in units of seconds</i></div><div><i> ;(currently set for ERA5 forcing)</i></div><div><i> ;---------------------------------------------------------------;<br></i></div><div><i> ; Weight filenames for regridding ;</i></div><div><i> ;---------------------------------------------------------------;</i></div><div><i> ;wgtFileName_conserve = "./NLDAS2WRFHydro_weight_conserve.nc"</i></div><div><i> wgtFileName_bilinear = "./ERA52WRFHydro_weight_bilinear.nc"</i></div><div><i> ;---------------------------------------------------------------;<br></i></div><div><i> ; Data field names from the source file to be regridded ;</i></div><div><i> ;---------------------------------------------------------------;</i></div></div><div><div><i> P_varname = "sp"</i></div><div><i> T_varname = "t2m"</i></div><div><i> U_varname = "u10"</i></div><div><i> V_varname = "v10"</i></div><div><i> ;Q_varname = "SPF_H_110_HTGL"</i></div><div><i> PCP_varname = "tp"</i></div><div><i> DSWR_varname = "msdwswrf"</i></div><div><i> DLWR_varname = "msdwlwrf"</i></div><div><i>;----------------------------------------------------------------------<br></i></div><div><i>; read in source and destination files</i></div><div><i>;----------------------------------------------------------------------</i></div><div><i>dstGridName="/glade/work/mirce/DOMAINS/DOMAIN_Files_250m_200/<a href="http://geo_em.d04.nc" target="_blank">geo_em.d04.nc</a>"<br></i></div><div><i><br></i></div><div><i> if ( .not.isfilepresent( dstGridName ) ) then</i></div><div><i> print( " ... source grid file not found : "+ dstGridName )</i></div><div><i> exit</i></div><div><i> end if</i></div><div><i><br></i></div><div><i>;--- destination grid data</i></div><div><i> dstfile = addfile( dstGridName ,"r")</i></div><div><i> dlon2d=dstfile->XLONG_M(0,:,:)</i></div><div><i> dlat2d=dstfile->XLAT_M(0,:,:)</i></div><div><i> dims=dimsizes(dlat2d)</i></div><div><i><br></i></div><div><i>; flag=0 ; flag for removing accum precip... (should be set to 0 for NLDAS2 forcing data)</i></div><div><i><br></i></div><div><i>;----------------------------------------------------------------------</i></div><div><i>; Open source data files to be regridded...</i></div><div><i>;----------------------------------------------------------------------</i></div><div><i> system("mkdir "+outdir)</i></div><div><i> srcFileName="download_*"<br></i></div><div><i> datfils = systemfunc ("ls "+dirm+srcFileName) ; list of file names<br></i></div><div><i> num_datfils = dimsizes(datfils)<br></i></div></div><div><i><br></i></div><div><i> do ifil = 0,num_datfils-1,1 ; loop through datafiles one at a time<br></i></div><div><div><i><br></i></div><div><i> datfile = addfile( datfils(ifil), "r")</i></div><div><i> print(datfile)</i></div><div><i><br></i></div><div><i> print( " ... Open input file : "+ datfils(ifil) )</i></div><div><i><br></i></div><div><i> ;Getting variables for time loop</i></div><div><i> time_1 = datfile->time</i></div><div><i> ntime = 100000.d ;Defining the time as double</i></div><div><i> ntime = dimsizes(time_1)</i></div><div><i><br></i></div><div><i> do t = 0,ntime-1,1 ;Loop through the time per file</i></div><div><i><br></i></div></div><div><i> <font color="#9900ff">; It does another do loop to read the variables and do some process with them</font></i></div><div><i><br></i></div><div><div><i> end do ; end for time loop<br></i></div><div><i> end do ; end do for file loop<br></i></div><div><i>end<br></i></div></div><div><br></div><div>;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::</div><div>The file it is processing has de following attributes:</div><div><div>Variable: datfile</div><div>Type: file</div><div>filename: download_200901_alltimesdays</div><div>path: /glade/scratch/mirce/LaSierra/FullDomainForcing/ERA5/<a href="http://download_200901_alltimesdays.nc" target="_blank">download_200901_alltimesdays.nc</a></div><div> file global attributes:</div><div> Conventions : CF-1.6</div><div> history : 2018-11-17 21:33:45 GMT by grib_to_netcdf-2.7.0: /opt/ecmwf/eccodes/bin/grib_to_netcdf -o /cache/data2/<a href="http://adaptor.mars.internal-1542489985.6343107-12063-21-3ffc2cf9-73f5-454d-bc1b-f54dfbfb6454.nc" target="_blank">adaptor.mars.internal-1542489985.6343107-12063-21-3ffc2cf9-73f5-454d-bc1b-f54dfbfb6454.nc</a> /cache/tmp/3ffc2cf9-73f5-454d-bc1b-f54dfbfb6454-adaptor.mars.internal-1542489985.6345837-12063-5-tmp.grib</div><div> dimensions:</div><div> longitude = 1440</div><div> latitude = 721</div><div> time = 744</div><div> variables:</div></div><div><br></div><div>I am sorry that this is quite long, if it's better, the path to the data and scripts is the following on Cheyenne:</div><div><b>/glade/scratch/mirce/LaSierra/FullDomainForcing/ERA5</b><br></div><div><br></div><div>I will appreciate any help about this error, in case more information is necessary you can tell me and I will add it.</div><div><br></div><div>Thanks!,</div><div>Mirce.</div><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Associate Scientist, Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br><br></div></div></div></div></div>