Hi,
please help me see the error in my script:
the error message:
pacman3 1887% ncl brunt-vaisala.ncl
Copyright (C) 1995-2011 - All Rights Reserved
University Corporation for Atmospheric Research
NCAR Command Language Version 6.0.0
The use of this software is governed by a License Agreement.
See http://www.ncl.ucar.edu/ for more details.
Variable: n
Type: float
Total Size: 5784210432 bytes
1446052608 values
Number of Dimensions: 4
Dimensions and sizes: [time | 264] x [plevels | 32] x [lat | 429] x [lon |
399]
Coordinates:
Number Of Attributes: 3
units : s-1
long_name : brunt-vaisala frequency
_FillValue : -99999
(0) Writing to file...
ncendef: ncid 65536: NetCDF: One or more variable sizes violate format
constraints
ncvarput: ncid 65536: NetCDF: Operation not allowed in define mode
fatal:NetCdf: An error occurred while attempting to write variable (n) to
file (brunt.nc)
fatal:Execute: Error occurred at or near line 200 in file brunt-vaisala.ncl
ncclose: ncid 65536: NetCDF: One or more variable sizes violate format
constraints
The script:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
begin
;## open work station
timedate = systemfunc("date +$Y-%m-%d-%H-%M")
wks = gsn_open_wks("pdf","bruntvaisala"+timedate)
gsn_define_colormap(wks,"WhiteYellowOrangeRed")
res = True
;TICKMARK RESOURCES (ON/OFF - FONT SIZE)
res@pmTickMarkDisplayMode = "Always"
res@tmXTOn = False
res@tmXBOn = True
res@tmYLOn = False
res@tmYROn = False
res@tmXTLabelFontHeightF = 0.025
res@tmXBLabelFontHeightF = 0.025
res@tmYLLabelFontHeightF = 0.025
res@tmYRLabelFontHeightF = 0.025
; MAP RESOURCES.
res@mpGridAndLimbOn = True
res@mpGridLineDashPattern = 2
res@mpGeophysicalLineColor = "Black"
res@mpGeophysicalLineThicknessF = 1.5
res@mpNationalLineColor = "Black"
res@mpNationalLineThicknessF = 1.5
res@mpUSStateLineColor = "Black"
res@mpUSStateLineThicknessF = 1.5
res@mpPerimLineColor = "Black"
;LABEL BAR RESOURCES
res@lbLabelAutoStride = True
res@lbOrientation = "Vertical"
res@lbLabelFontHeightF = 0.025
;CONTOUR RESOURCES
res@cnFillOn = True
res@cnLinesOn = False
res@cnLineColor = "Blue"
res@cnLineThicknessF = 2.
res@cnInfoLabelOn = False
res@cnLineLabelsOn = False
res@cnLineLabelPerimOn = True
res@cnLineLabelBackgroundColor = 0.
; res@cnLevelSelectionMode = "ManualLevels"
; res@cnMinLevelValF = -20.
; res@cnMaxLevelValF = 30.
; res@cnLevelSpacingF = 2.
;GSN RESOURCES
res@gsnSpreadColors = True
res@gsnLeftString = " "
res@gsnRightString = " "
;res@gsnDraw = False
;res@gsnFrame = False
res@gsnMaximize = True
;TITLE RESOURCES
res@tiMainOn = True
res@tiMainPosition = "Center"
res@tiMainFontHeightF = 0.025
;PROJECTION RESOURCES
res@tfDoNDCOverlay = True
res@gsnAddCyclic = False
res@mpProjection = "Stereographic"
res@mpLimitMode = "Corners"
res@mpLeftCornerLatF = 65.80
res@mpLeftCornerLonF = 132.8014
res@mpRightCornerLatF = 65.0
res@mpRightCornerLonF = -45.0
res@mpCenterLatF = 90
res@mpCenterLonF = -180
;## day when integration started
day = "15"
;## hour when integration started
hour = "00"
;## path to wpp outfiles
;path =
"/wrkdir/moreira/wrf-pacman-compilation-03-22-11/WRFV3/Ensemble-Runs/run-"+day+"@"+hour+"/postprd/"
path = "/import/wrkdir1/asemenov/WRF/WRFV3/10_25.03_res_30_10km/postprd/"
;## file name
files = systemfunc("ls "+path+"WRFPRS_d02.*")
;## create array to hold result
n = new ( (/264,32,429,399/), "float" )
n@_FillValue = -99999
n = n@_FillValue
n@long_name = "brunt-vaisala frequency"
n@units = "s-1"
n!0 = "time"
n!1 = "plevels"
n!2 = "lat"
n!3 = "lon"
printVarSummary(n)
N2 = n
N2 = N2@_FillValue
do j = 240, dimsizes(files)-1
fname = files(j)
;## open file
print("Opening file: "+fname+".grb")
f = addfile (fname+".grb", "r")
;## get variables
print ("Getting variables...")
g = 9.81
theta = f->POT_GDS5_HYBL_10
z = f->HGT_GDS5_HYBL_10
p = f->PRES_GDS5_HYBL_10
levels = f->lv_HYBL3
lat = f->g5_lat_1
lon = f->g5_lon_2
; print("Levels: ")
; print(levels)
; printVarSummary(theta)
; printVarSummary(p)
printVarSummary(z)
;## calculate n2
print ("Calculating dTdZ and N2...")
dThetadZ = center_finite_diff_n(theta,z,False,0,0)
n2 = (1/theta) * g * dThetadZ
; printVarSummary(dThetadZ)
printVarSummary(n2)
;## interpolate to pressure coords
; pls = (/ 1000.,925.,850.,800.,750.,700.,650.,600., \
; 500.,450.,400.,350.,300.,250.,200.,150.,100.,70.,50. /)
pls = (/
1000.,950.,925.,900.,875.,850.,825.,800.,775.,750.,725.,700.,675.,650.,625.,600.,575.,550.,525.,
\
500.,475.,450.,425.,400.,350.,300.,250.,200.,150.,100.,70.,50. /)
print ("Interpolating...")
n2_pls = wrf_user_intrp3d(n2,p,"h",pls,0.,False)
printVarSummary(n2_pls)
printMinMax(n2,True)
printMinMax(n2_pls,True)
printMinMax(n,True)
;## get n
print ("Calculating N...")
n(j,:,:,:) = where(n2_pls.gt.0,sqrt(n2_pls),n2_pls@_FillValue)
N2(j,:,:,:) = (/ n2_pls /)
; printMinMax(theta,True)
; printMinMax(z,True)
; printMinMax(dThetadZ,True)
; printMinMax(n2,True)
; printMinMax(n2_pls,True)
; printMinMax(n,True)
;## plot
print ("Plotting...")
jj = 2
; res@gsnLeftString = n@long_name+" ("+n@units+") at "+pls(jj)+" hPa at
time "+j
; res@gsnLeftString = N2@long_name+" ("+N2@units+") at "+pls(jj)+" hPa
at time "+j
plot = gsn_csm_contour_map(wks,N2(j,jj,:,:),res)
end do
;## write to file
print ("Writing to file...")
a = systemfunc("rm -f brunt.nc")
fileout = addfile("brunt.nc","c")
fileout->n2=N2
fileout->n=n
fileout->lat=lat
fileout->lon=lon
fileout->plevels=pls
end
-- regards ******************************************************* *Alexander Semenov* PhD Student - Research Assistant International Arctic Research Center Department of atmospheric sciences University of Alaska Fairbanks
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 9 12:36:34 2012
This archive was generated by hypermail 2.1.8 : Thu Feb 09 2012 - 13:33:26 MST