[ncl-talk] Dimension (nlon) of (var0) does not have an associated coordinate variable

Hughlett, Taylor M taylor.hughlett at uta.edu
Wed Feb 1 12:03:14 MST 2017


Good afternoon!

I am attempting to produce a time series of our SFWF variable from our POP2 output in CESM1.2 and am getting the following error:

Dimension (nlon) of (var0) does not have an associated coordinate variable

No matter how I attempt to treat the variable var0 (specifying coordinates manually, applying Meta data from other variables, etc), the program does not seem to associate nlon with a coordinate variable.

The code is below my signature for the email. Any help with this would be wonderful. I've already looked through some of the fixes that were posted on the ncl-talk list, but none worked for me.

Thanks in advance!

Taylor M Hughlett, Ph.D.
UTA Earth and Environmental Sciences
500 Yates St.
Geoscience Bldg Rm 117
Arlington, TX 76013-0049



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/csm/contributed.ncl"

begin

;**************************************************
; Set file paths and plot specifics
;**************************************************

print("Setting File Paths")

;***** File Paths and Names *****

case       = "b.e12.B1850C5CN.f09_g16.YD13ka.003"
filen      = "b.e12.B1850C5CN.f09_g16.YD13ka.003.pop.SFWF.1_cat_840.nc"
file_loc   = "/glade/scratch/hughlett/csm/b.e12.B1850C5CN.f09_g16.YD13ka.003/ocn/tseries/cat/"
grid       = "b.e12.B1850C5CN.f09_g16.YD13ka.003.pop.h.0810.nc"
grid_loc   = "/glade/scratch/hughlett/csm/b.e12.B1850C5CN.f09_g16.YD13ka.003/ocn/hist/"
plot_loc   = "/glade/scratch/hughlett/plots/b.e12.B1850C5CN.f09_g16.YD13ka.003/timeseries"

;***** Text for Plot *****

CenterString = "Surface Freshwater Flux"
YAxisString  = "SFWF (Sverdrups)"
XAxisString  = "Years"

;***** Start and End Time for Plot *****

plot_begin = 0001
plot_end   = 840

;***** Data Options (0 = no, 1 = yes) *****

smooth  = 0
dtrd    = 0
ncwrite = 0

;**************************************************
; Read In and Process Data
;**************************************************

print("Reading in and processing data")

;***** Read in All Variables *****

fvar  = addfile(file_loc+filen,"r")
fgrid = addfile(grid_loc+grid,"r")

var0  = fvar->SFWF(:,:,:)
lat2d = fgrid->TLAT
lon2d = fgrid->TLONG

;***** Create a More Plottable Timeline *****

years = ispan(plot_begin,plot_end,1)
nyrs = dimsizes(years)

;***** Copy Over Coordinate Data *****

LON2D  = lon2d(::1,::1)
LAT2D  = lat2d(::1,::1)
var0 at nlon = LON2D
var0 at nlat = LAT2D

printVarSummary(var0)
;**************************************************
; Open workstation, set plot resources, and plot
;**************************************************

print("Creating Plot")

;***** Create Plot Name *****

pname = var + "." + case + "_" + "timeseries_0m" + plot_begin + "-" + plot_end

;***** Open workstation *****

wks = gsn_open_wks("ps",plot_loc+pname)

;***** Set Resources *****

res                      = True
res at gsnMaximize          = True
res at gsnFrame             = False
res at gsnDraw              = False
res at vpHeightF            = .23
res at vpWidthF             = .783
res at tiXAxisFontHeightF   = .015
res at tiYAxisFontHeightF   = .015
res at tmYLLabelFontHeightF = .015
res at tmXBLabelFontHeightF = .015
res at gsnLeftString        = " "
res at gsnRightString       = " "
res at xyLineColor          = (/"black"/)
res at gsnCenterString      = CenterString
res at tiYAxisString        = YAxisString
res at tiXAxisString        = XAxisString
res at trYMinF              = 15
res at trYMaxF              = 19

;***** Create New Plot *****

plot      = new(1,graphic)
plot(0)   = gsn_csm_xy (wks,years,var0(:,{28},{50}),res)

print("Plot Created")

End

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170201/e47067ba/attachment.html 


More information about the ncl-talk mailing list