<div dir="ltr"><div>[1] It is likely that NCL's "dimension reduction" is the issue. Generally, this is a "feature" on NCL. However, sometimes it requires some extra coding. You must use an 'if' to test. Maybe something like:<br></div><div><br></div><div> dimr = dimsizes(rain)</div><div> ntim = dimr(0)</div><div> nlat = dimr(1)</div><div> mlon = dimr(2)</div><div> if (ntim.eq.1) then</div><div> rain_aave = new ((/1,nlat,mlon/), typeof(rain_region),getVarFillVaalue(rain_region))</div><div> rain_aave(0,:,:) =wgt_areaave_Wrap(rain_region,1.0,1.0,0)</div><div> else</div><div> .rain_aave=wgt_areaave_Wrap(rain_region,1.0,1.0,0)</div><div> end if<br></div><div><br></div><div>[2] <br></div><div>undef("add_hyphen")</div><div>function add_hyphen(yyyymmdd[*]:integer)</div><div>local yyyy, mmdd, mm, dd<br></div><div>begin</div><div> yyyy = yyyymmdd/10000</div><div> mmdd = yyyymmdd-(yyyymmdd*10000)</div><div> mm = mmdd/100</div><div> dd = mmdd-(mm*100)</div><div> return(yyyy+"-"+mm+"-"+dd)</div><div>end<br></div><div> <br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 29, 2019 at 4:19 AM Lyndz via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear NCL-experts,<div><br></div><div>I trying to run my script (attached in this email). There are two issues that I would like to address and ask for help.</div><div> </div><div><b>[1] The script runs but the output time dimension is incorrect when only one-time step satisfies the conditions. For cases with multiple time steps satisfying the conditions, the output is ok. Notice the time is 0 from the ncdump below. Any ideas how to solve this issue?</b></div><div><br></div><div>Here's the ncdump of the output netcdf file when only one time-step satisfies the coditions:</div><div>dimensions:</div><div><br> time = UNLIMITED ; // (0 currently)<br> latitude = 280 ;<br> longitude = 360 ;<br>variables:<br> float rain(latitude, longitude) ;<br> rain:time = 116. ;<br> rain:level_description = "Earth surface" ;<br> rain:missing_value = -99.9f ;<br> rain:_FillValue = -99.9f ;<br> rain:units = "mm/day" ;<br> rain:long_name = "daily precipitation analysis interpolated onto 0.25deg grids [mm/day]" ;<br> double latitude(latitude) ;<br> latitude:axis = "Y" ;<br> latitude:units = "degrees_north" ;<br> latitude:long_name = "Latitude" ;<br> latitude:standard_name = "latitude" ;<br> double longitude(longitude) ;<br> longitude:axis = "X" ;<br> longitude:units = "degrees_east" ;<br> longitude:long_name = "Longitude" ;<br> longitude:standard_name = "longitude" ;<br><br>// global attributes:<br> :creation_date = "Thu Aug 29 18:28:59 JST 2019" ;<br> :Conventions = "None" ;<br> :source_file = "Daily Aphrodite Rainfall" ;<br> :title = "rain_stretch equal rain_threshold=0" ;<br>}<br></div><div><b><br></b></div><div><b>[2] One part of the script save the dates into a text file. Is there a way to save the output file as YYYY-MM-DD separated by a dash (-) instead of YYYYMMDD?</b></div><div><br></div><div>I'll appreciate any help about these.</div><div><br></div><div>Sincerely,</div><div><br></div><div>Lyndz</div><div><b><br></b></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></blockquote></div>