<div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Mirce,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Have you tried plotting it?  We have some template scripts that you can use for plotting regridded data:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/Templates/#ESMFRegriddingTemplates">http://www.ncl.ucar.edu/Applications/Templates/#ESMFRegriddingTemplates</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">You will see a number of scripts, like "curvilinear to curviinear".  You want to use the one that matches what grid you started with, and what grid/mesh you regridded to.  Each of these have a plotting section that you can cut-and-pasted, and then you will need to modify it for your own data.</div><div class="gmail_default"><br></div><div class="gmail_default">I believe your source grid was rectilinear and your destination grid was curvilinear, so this might be the one you want:</div><div class="gmail_default"><br></div><div class="gmail_default"><a href="http://www.ncl.ucar.edu/Applications/Templates/ESMF_rect_to_curv.ncl">http://www.ncl.ucar.edu/Applications/Templates/ESMF_rect_to_curv.ncl</a><br></div><div class="gmail_default"><br></div><div class="gmail_default">The script has several comments of the form "<span style="color:rgb(0,0,0);white-space:pre-wrap">;;---Change", which indicates places that you will likely have to change to work with your own data.</span></div><div class="gmail_default"><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div class="gmail_default"><span style="color:rgb(0,0,0);white-space:pre-wrap">If you have questions about using this script, then please post back to ncl-talk.</span></div><div class="gmail_default"><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div class="gmail_default"><span style="color:rgb(0,0,0);white-space:pre-wrap">Good luck,</span></div><div class="gmail_default"><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div class="gmail_default"><span style="color:rgb(0,0,0);white-space:pre-wrap">--Mary</span></div><div class="gmail_default"><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div class="gmail_default"><br></div><div class="gmail_default"><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Nov 22, 2018 at 7:39 PM 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">Hello Again Mary,<div><br></div><div>Regarding my regridding script, I did the changes you told me and fixed the var problem and the script is working well, thank you very much!!.</div><div><br></div><div>Now I am having issues to verify that the regridding is well done...Since I am regridding global data to a small region, it is not easy to verify at first look.</div><div><br></div><div>Thanks!,</div><div>Mirce.</div></div><br><div class="gmail_quote"><div dir="ltr">El lun., 19 nov. 2018 a las 12:24, Mirce Morales (<<a href="mailto:mirce.morales@gmail.com" target="_blank">mirce.morales@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Mary!,<div><br></div><div>Thank you very much for looking at the script!, I will do the all the changes you told me, I totally forgot about the "gt." and ".lt". in my loops., thanks, and  I'll try to fix the var problem.</div><div>I'll be back in a moment to update you about the error.</div><div><br></div><div>Thanks a lot again.</div><div><br></div><div>Cheers,</div><div>Mirce.</div></div><br><div class="gmail_quote"><div dir="ltr">El lun., 19 nov. 2018 a las 11:04, Mary Haley (<<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</a>>) escribió:<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 class="gmail_default" style="font-size:small">Mirce,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I don't think the problem is with the regridding per se.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The issue is with one of your "do" loops which is using a double as a loop index, and the use of ">" and "<" instead of ".gt." and ".lt".</div><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small">You have:</div><br></div>   ntime = 100000.d     ;Defining the time as double      <br>   ntime = dimsizes(time_1)                                                                                            <br>   do t = 0,ntime-1,1     ;Loop through the time per file    <div dir="ltr"><br></div><div dir="ltr"><div class="gmail_default" style="font-size:small">NCL apparently doesn't like the double as a loop argument, which kind of surprises me. If you really need t to be double, you could do this:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default">   ntime = dimsizes(time_1)                                                                                       <br></div><div class="gmail_default">   do it = 0,ntime-1,1     ;Loop through the time per file </div><div class="gmail_default">     t = todouble(it)</div><div class="gmail_default"><br></div><div class="gmail_default">To fix the other problem, change these lines:</div></div></div><div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><div class="gmail_default">     if (t < 24)</div><div class="gmail_default">     if (t>24)<br></div><div class="gmail_default"><br></div><div class="gmail_default">to:<br></div><div class="gmail_default"><br></div><div class="gmail_default">     if (t .lt. 24)<br></div><div class="gmail_default"><div class="gmail_default">     if (t.gt.24)</div><br class="m_606643174263924804m_-5584562251894757610m_-2892181488880650657gmail-Apple-interchange-newline"></div><div class="gmail_default">These changes still don't fix your script, because "var" is undefined when the "do v=1,7" loop gets to "v=2", causing an error.  I assume you can fix this, since it looks like you have some commented code to deal with this.</div><div class="gmail_default"><br></div><div class="gmail_default">Good luck,</div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Nov 19, 2018 at 10:41 AM Mary Haley <<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.edu</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 class="gmail_default" style="font-size:small">Hi Mirce,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Since the files are on cheyenne, I'll have a look. I'll respond back to ncl-talk if I have any suggestions.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Nov 18, 2018 at 11:53 PM Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com" target="_blank">barry.h.lynn@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">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" target="_blank">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="m_606643174263924804m_-5584562251894757610m_-2892181488880650657m_-8098934244025295726m_1813862027520516191gmail_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>
_______________________________________________<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>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>