<div dir="ltr"><div class="gmail_default" style="font-size:small">It looks like you are trying to change the "time" coordinate array, but I don'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 "time" array called "TIME" with a units of "<span style="font-size:12.8px">HOURS since 1901-01-15 00:00:00".</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'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->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 = "time"</div><div class="gmail_default" style="">time&time = time</div><div class="gmail_default" style="">sf!0 = "time"</div><div class="gmail_default" style="">sf&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't fix the problem. It will be helpful if you can include the output from a "printVarSummary" 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"><<a href="mailto:mberdahl@envsci.rutgers.edu" target="_blank">mberdahl@envsci.rutgers.edu</a>></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'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'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'm not sure of what this error means.<br>
<br>
Below I'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 = "degrees" ;<br>
LAT:long_name = "Latitude" ;<br>
LAT:history = "From ICE.j57.1958.01.01-15" ;<br>
float LON(Y18_127, X10_69) ;<br>
LON:units = "degrees" ;<br>
LON:long_name = "Longitude" ;<br>
LON:history = "From ICE.j57.1958.01.01-15" ;<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 = "Snowfall" ;<br>
SF:units = "mmWE/day" ;<br>
SF:history = "From ICE.j57.1958.01.01-15" ;<br>
double TIME(TIME) ;<br>
TIME:units = "HOURS since 1901-01-15 00:00:00" ;<br>
TIME:long_name = "time" ;<br>
TIME:time_origin = "15-JAN-1901 00:00:00" ;<br>
TIME:axis = "T" ;<br>
double X10_69(X10_69) ;<br>
X10_69:units = "km" ;<br>
X10_69:long_name = "x" ;<br>
X10_69:point_spacing = "even" ;<br>
X10_69:axis = "X" ;<br>
double Y18_127(Y18_127) ;<br>
Y18_127:units = "km" ;<br>
Y18_127:long_name = "y" ;<br>
Y18_127:point_spacing = "even" ;<br>
Y18_127:axis = "Y" ;<br>
******************************************************<br>
<br>
<br>
<br>
******************************************************<br>
<br>
<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br>
<br>
;************************************************<br>
begin<br>
;************************************************<br>
; read in netCDF file s<br>
;************************************************<br>
;a = addfile("<a href="http://ICE.ALL.SF.nc" rel="noreferrer" target="_blank">ICE.ALL.SF.nc</a>","r") ; snow fall only<br>
b = addfile("<a href="http://ICE.1984.01-12.f78.nc" rel="noreferrer" target="_blank">ICE.1984.01-12.f78.nc</a>","r") ; this will give me the lat/lon info<br>
<br>
c = addfile("<a href="http://test.nc" rel="noreferrer" target="_blank">test.nc</a>","r")<br>
;************************************************<br>
; read in qonal [u] and meridional [v] winds (July)<br>
;************************************************<br>
<br>
;sf = a->SF(:,:,:) ; snow fall<br>
<br>
sf = c->SF(:,:,:)<br>
time = c->TIME<br>
<br>
; do some finangling with the time variable/attribute<br>
time!0 = "time"<br>
time&time = time<br>
sf!0 = "time"<br>
sf&time = time<br>
<br>
<br>
lat2d = b->LAT<br>
lon2d = b->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,"avg",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&TIME<br>
;yyyymm = yyyymmdd/100<br>
;yyyy = yyyymm/100<br>
;mm = yyyymm-yyyy*100;<br>
<br>
;sf_avg = new((/nyrs,nmos,nlat,nlon/),"float")<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("ps","MAR_SF_total") ; open a ps file<br>
gsn_define_colormap(wks,"temp1")<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>