<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
I have a large set of files (time,level,lat,lon and 6 hourly) that span multiple years, but they are not divided nicely into months/years. I only want to read in one month at a time (and only 00Z), which in some cases, spans only one file, but in other cases
 spans two.
<div class=""><br class="">
</div>
<div class="">My code works perfectly for the months that come from only one file, but I get a “Segmentation fault (core dumped)” when the month spans two files. See brief code example below (happy to send more and actual files if needed).</div>
<div class=""><br class="">
</div>
<div class="">example files:&nbsp;</div>
<div class="">temp_195001010600-195007010000.nc</div>
<div class="">temp_195007010600-195107010000.nc</div>
<div class=""><br class="">
</div>
<div class="">example code snipet:</div>
<div class=""><br class="">
</div>
<div class="">…….</div>
<div class="">
<div class="">all_files = systemfunc (&quot;ls “&#43;in_path&#43;&quot;temp_195*.nc&quot;)</div>
<div class="">f &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= addfiles (all_files, &quot;r&quot;) &nbsp;&nbsp;</div>
<div class=""><br class="">
</div>
</div>
<div class="">
<div class="">ListSetType(f,&quot;cat&quot;)</div>
<div class="">time &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= &nbsp; &nbsp; &nbsp; f[:]-&gt;time</div>
<div class=""><br class="">
</div>
<div class="">utc_date = cd_calendar(time, 0)</div>
<div class="">yr<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre">
</span>tointeger(utc_date(:,0))</div>
<div class="">mm<span class="Apple-tab-span" style="white-space:pre"> </span>=<span class="Apple-tab-span" style="white-space:pre">
</span>tointeger(utc_date(:,1))</div>
<div class="">hour = &nbsp; &nbsp; tointeger(utc_date(:,3))</div>
</div>
<div class=""><br class="">
</div>
<div class="">index = ind(yr.eq.1950 .and. mm.eq.7 &nbsp;.and. hour.eq.00)<span class="Apple-tab-span" style="white-space: pre;">
</span></div>
<div class=""><br class="">
</div>
<div class="">
<div class="">ListSetType(f,&quot;cat&quot;)<span class="Apple-tab-span" style="white-space:pre">
</span></div>
<div class="">ta &nbsp; &nbsp; &nbsp;= &nbsp; &nbsp; &nbsp; f[:]-&gt;ta(index,:,:,:)<span class="Apple-tab-span" style="white-space:pre">
</span></div>
…………</div>
<div class=""><br class="">
</div>
<div class="">As I mentioned, this works great if mm.eq.1, mm.eq.2 etc., but not when mm.eq.7. When reading in ta(index,:,:,:) I get the segmentation fault.<span class="Apple-tab-span" style="white-space:pre">
</span></div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Thank you!</div>
<div class=""><br class="">
</div>
<div class="">Elinor</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">
<div style="orphans: 2; widows: 2;" class="">*******************************************</div>
<div style="orphans: 2; widows: 2;" class="">Dr. Elinor Martin<br class="">
Assistant Professor</div>
<div style="orphans: 2; widows: 2;" class="">School of Meteorology<br class="">
University of Oklahoma</div>
<div style="orphans: 2; widows: 2;" class=""><span style="orphans: auto; widows: auto;" class="">120 David L. Boren Blvd. Suite 5900</span></div>
<div style="orphans: 2; widows: 2;" class="">Norman, OK 73072-7307</div>
<div style="orphans: 2; widows: 2;" class=""><br class="">
</div>
<div style="orphans: 2; widows: 2;" class="">Office: NWC 5642</div>
<div style="orphans: 2; widows: 2;" class="">Email: <a href="mailto:elinor.martin@ou.edu" class="">
elinor.martin@ou.edu</a></div>
<div style="orphans: 2; widows: 2;" class="">Phone: 405 325 7392</div>
<div style="orphans: 2; widows: 2;" class="">Web: <a href="http://weather.ou.edu/~ermartin" class="">
http://weather.ou.edu/~ermartin</a></div>
<div style="orphans: 2; widows: 2;" class="">*******************************************</div>
</div>
<div class=""><br class="">
</div>
</div>
<br class="Apple-interchange-newline">
</div>
<br class="Apple-interchange-newline">
</div>
<br class="Apple-interchange-newline">
</div>
<br class="Apple-interchange-newline">
<br class="Apple-interchange-newline">
</div>
<br class="">
</div>
</body>
</html>