<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">NCL-Talk,</div><div class=""><br class=""></div>I'm attempting to modify the <a href="https://sundowner.colorado.edu/wrfout_to_cf/release_notes.html" class="">wrfout_to_cf.ncl</a> script by Matt Higgins to loop over time. The existing script calculates variables like SLP by ingesting the entire dataset and then spitting out the result. For smaller domains / fewer frames per outfile, this works fine. For my outfile, I have 601 timesteps and a domain of 1664x1544x50 meaning each 4-D variable takes up ~288GB, which is way too much to work with efficiently in memory.<div class=""><br class=""></div><div class="">I'm trying to re-structure the code so that it loops over time. E.g. at each timestep for SLP it will calculate SLP from 3-D fields (x,y,z) and then output a 2-D array (x,y) to save to a NetCDF. The problem comes when I try to save to NetCDF, I get an error...</div><div class="">fatal:["Execute.c":8637]:Execute: Error occurred at or near line 461 in file wrfout_to_cf_timefix.ncl</div><div class=""><br class=""></div><div class="">when code is executed as...</div><div class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""> do n = 0, nTime-1</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""> </span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">print(n)</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""> ;</span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">slp(n,:,:)=(/wrf_user_getvar(wrfout,"slp",n)/)</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""> </span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">wrfpost->slp(n,:,:)=(/wrf_user_getvar(wrfout,"slp",n)/) <- Errors out</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""> </span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">end do</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""> ;</span><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class="">wrfpost->slp =slp</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""></div><div class=""><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);" class=""><br class=""></span></div><div class="">wrfpost = output file.</div><div class="">slp = netcdf variable (601,1664,1544)</div><div class="">n = timestep</div><div class=""><br class=""></div><div class="">However, when I (less efficiently) run over the loop of 601 timesteps and save them to a 3-D SLP variable, then dump them into the NetCDF file, it works fine...</div><div class=""> do n = 0, nTime-1<br class=""> print(n)<br class=""> slp(n,:,:)=(/wrf_user_getvar(wrfout,"slp",n)/)<br class=""> ;wrfpost->slp(n,:,:)=(/wrf_user_getvar(wrfout,"slp",n)/)<br class=""> end do<br class=""> wrfpost->slp =slp <- Works fine<br class=""><br class=""></div><div class="">AFAIK, the dimsizes are lined up correctly. Ideally, I would execute this code over each timestep, save the result to the NetCDF file, then rerun so at any point I only have 3-D/2-D and not 4-D/3-D arrays to handle to save memory. I know I could ncks the wrfout file into smaller chunks but I'd rather figure out what's going on than work around it.</div><div class=""><br class=""></div><div class="">The entire script is attached, for the sake of simplicity ignore the other 4-D variables. Once I have SLP figured out, the others should fall into place.</div><div class=""><br class=""></div><div class="">Please let me know what I'm doing that's stupid.</div><div class=""><br class=""></div><div class="">Thanks!</div><div class=""><br class=""></div><div class="">-Joe</div><div class=""><br class=""></div><div class=""></div></body></html>