<div dir="ltr"><div class="gmail_default" style="font-size:small">It looks like you are trying to change the &quot;time&quot; coordinate array, but I don&#39;t think this is necessary.  <br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">When you read SF off the file, it appears to have a correct &quot;time&quot; array called &quot;TIME&quot; with a units of &quot;<span style="font-size:12.8px">HOURS since 1901-01-15 00:00:00&quot;.</span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">Therefore, the following code is unnecessary and should be commented out (and removed when/if you verify you don&#39;t need it):</span></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style=""><div class="gmail_default" style="">time = c-&gt;TIME</div><div class="gmail_default" style=""><br></div><div class="gmail_default" style="">; do some finangling with the time variable/attribute</div><div class="gmail_default" style="">time!0  = &quot;time&quot;</div><div class="gmail_default" style="">time&amp;time = time</div><div class="gmail_default" style="">sf!0 = &quot;time&quot;</div><div class="gmail_default" style="">sf&amp;time = time</div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Please post back to ncl-talk if this doesn&#39;t fix the problem.  It will be helpful if you can include the output from a &quot;printVarSummary&quot; of whatever variable you are passing to calculate_monthly_values.</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><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 19, 2015 at 6:04 PM,  <span dir="ltr">&lt;<a href="mailto:mberdahl@envsci.rutgers.edu" target="_blank">mberdahl@envsci.rutgers.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
I&#39;m trying to use a contributed function that calculates monthly means<br>
from daily data (calculate_monthly_values).  However, I run into this<br>
error:<br>
<br>
warning:ut_calendar: Invalid specification string. Missing values will be<br>
returned.<br>
fatal:New: The dimension size list contains missing values, can&#39;t<br>
determine size<br>
fatal:Execute: Error occurred at or near line 11754 in file<br>
$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl<br>
<br>
fatal:Execute: Error occurred at or near line 55 in file plotSF.ncl<br>
<br>
<br>
I&#39;m not sure of what this error means.<br>
<br>
Below I&#39;ve copied the ncdump output of the input file <a href="http://test.nc" rel="noreferrer" target="_blank">test.nc</a> and my script.<br>
Thanks in advance for any help or advice!<br>
Mira<br>
<br>
<br>
*******************************************************<br>
ncdump -h <a href="http://test.nc" rel="noreferrer" target="_blank">test.nc</a> | less<br>
netcdf test {<br>
dimensions:<br>
        Y18_127 = 110 ;<br>
        X10_69 = 60 ;<br>
        TIME = UNLIMITED ; // (3652 currently)<br>
variables:<br>
        float LAT(Y18_127, X10_69) ;<br>
                LAT:units = &quot;degrees&quot; ;<br>
                LAT:long_name = &quot;Latitude&quot; ;<br>
                LAT:history = &quot;From ICE.j57.1958.01.01-15&quot; ;<br>
        float LON(Y18_127, X10_69) ;<br>
                LON:units = &quot;degrees&quot; ;<br>
                LON:long_name = &quot;Longitude&quot; ;<br>
                LON:history = &quot;From ICE.j57.1958.01.01-15&quot; ;<br>
        float SF(TIME, Y18_127, X10_69) ;<br>
                SF:missing_value = -1.e+34f ;<br>
                SF:_FillValue = -1.e+34f ;<br>
                SF:long_name = &quot;Snowfall&quot; ;<br>
                SF:units = &quot;mmWE/day&quot; ;<br>
                SF:history = &quot;From ICE.j57.1958.01.01-15&quot; ;<br>
        double TIME(TIME) ;<br>
                TIME:units = &quot;HOURS since 1901-01-15 00:00:00&quot; ;<br>
                TIME:long_name = &quot;time&quot; ;<br>
                TIME:time_origin = &quot;15-JAN-1901 00:00:00&quot; ;<br>
                TIME:axis = &quot;T&quot; ;<br>
        double X10_69(X10_69) ;<br>
                X10_69:units = &quot;km&quot; ;<br>
                X10_69:long_name = &quot;x&quot; ;<br>
                X10_69:point_spacing = &quot;even&quot; ;<br>
                X10_69:axis = &quot;X&quot; ;<br>
        double Y18_127(Y18_127) ;<br>
                Y18_127:units = &quot;km&quot; ;<br>
                Y18_127:long_name = &quot;y&quot; ;<br>
                Y18_127:point_spacing = &quot;even&quot; ;<br>
                Y18_127:axis = &quot;Y&quot; ;<br>
******************************************************<br>
<br>
<br>
<br>
******************************************************<br>
<br>
<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl&quot;<br>
<br>
;************************************************<br>
begin<br>
;************************************************<br>
; read in netCDF file s<br>
;************************************************<br>
;a = addfile(&quot;<a href="http://ICE.ALL.SF.nc" rel="noreferrer" target="_blank">ICE.ALL.SF.nc</a>&quot;,&quot;r&quot;) ; snow fall only<br>
b = addfile(&quot;<a href="http://ICE.1984.01-12.f78.nc" rel="noreferrer" target="_blank">ICE.1984.01-12.f78.nc</a>&quot;,&quot;r&quot;) ; this will give me the lat/lon info<br>
<br>
c = addfile(&quot;<a href="http://test.nc" rel="noreferrer" target="_blank">test.nc</a>&quot;,&quot;r&quot;)<br>
;************************************************<br>
; read in qonal [u] and meridional [v] winds (July)<br>
;************************************************<br>
<br>
;sf = a-&gt;SF(:,:,:) ; snow fall<br>
<br>
sf = c-&gt;SF(:,:,:)<br>
time = c-&gt;TIME<br>
<br>
; do some finangling with the time variable/attribute<br>
time!0  = &quot;time&quot;<br>
time&amp;time = time<br>
sf!0 = &quot;time&quot;<br>
sf&amp;time = time<br>
<br>
<br>
lat2d = b-&gt;LAT<br>
lon2d = b-&gt;LON<br>
<br>
sf@lon2d = lon2d<br>
sf@lat2d = lat2d<br>
<br>
printVarSummary(sf)<br>
<br>
;  calculate the total snow fall for the entire period.<br>
sf_total = dim_sum_n(sf,0)<br>
<br>
; calculate the monthly averages<br>
sfMonthAvg = calculate_monthly_values(sf,&quot;avg&quot;,0,False)<br>
<br>
printVarSummary(sfMonthAvg)<br>
<br>
;; calculate the monthly mean snowfall from daily data<br>
;yrStrt = 1958;<br>
;yrLast = 2012;<br>
;nyrs = yrLast -yrStrt +1<br>
;nmos = 12<br>
;;nlat = 110<br>
;;nlon = 60<br>
<br>
<br>
;printVarSummary(nlat)<br>
;yyyymmdd = sf&amp;TIME<br>
;yyyymm  = yyyymmdd/100<br>
;yyyy = yyyymm/100<br>
;mm = yyyymm-yyyy*100;<br>
<br>
;sf_avg = new((/nyrs,nmos,nlat,nlon/),&quot;float&quot;)<br>
;do yr = yrStrt,yrLast<br>
;        nyr = yr - yrStrt<br>
;       do mo = 1,nmos<br>
;               i = ind(yyyy.eq.yr .and. <a href="http://mo.eq.mm" rel="noreferrer" target="_blank">mo.eq.mm</a>)<br>
;               sf_avg(nyr,mo-1,:,:) = dim_avg_n(sf(i,:,:),0)<br>
;               delete(i)<br>
;       end do<br>
;end do<br>
<br>
<br>
<br>
sf_total@lon2d = lon2d<br>
sf_total@lat2d = lat2d<br>
sf_avg@lon2d = lon2d<br>
sf_avg@lat2d = lat2d<br>
<br>
<br>
printVarSummary(sf_total)<br>
<br>
;  lat goes from 58.9982 to 84.1492, looks like it is polar stereographic<br>
;  lon goes from -89.9739 to 7.01787<br>
;************************************************<br>
; create plot<br>
;************************************************<br>
wks = gsn_open_wks(&quot;ps&quot;,&quot;MAR_SF_total&quot;)                 ; open a ps file<br>
gsn_define_colormap(wks,&quot;temp1&quot;)<br>
<br>
<br>
;---- set common resources for all plots<br>
res                     = True<br>
res@cnLinesOn           = False<br>
res@cnFillOn            = True  ; color plot desired<br>
res@cnLineLabelsOn      = False ; turn off contour lines<br>
<br>
<br>
<br>
;****************************************************<br>
; choose a subregion<br>
;****************************************************<br>
<br>
res@mpMaxLatF = 84<br>
res@mpMinLatF = 59<br>
res@mpMaxLonF = 373<br>
res@mpMinLonF = 270<br>
<br>
map = gsn_csm_contour_map(wks,sfMonthAvg,res)<br>
<br>
<br>
end<br>
<br>
<br>
*************************************************************<br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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></div>