Problem with coordinate variable

From: <wanda7_at_nyahnyahspammersnyahnyah>
Date: Wed Sep 25 2013 - 02:12:50 MDT

Hi,

I keep getting error messages related to longitude not being a coordinate
variable of another variable, and I've done everything that I usually do to
solve this problem, but just can't seem to get it right (I've done lots of
this sort of script before -in fact I pretty much copied and pasted from a
script that actually works)...I'm using NCL 6.1.0b...(the script is below...)

Can anyone suggest something that I might be overlooking? I've looked at
previous ncl-talk posts and tried various things but so far haven't found a
solution.

The error messages are:

fatal:No coordinate variable exists for dimension (lat) in variable (var1)
fatal:(lat) is not coordinate variable in variable(var1).
fatal:["Execute.c":7556]:Execute: Error occurred at or near line 31 in file
diff_plot_var1var2.ncl

Thank you for your advice...

Wanda

;************************************************************************************

begin

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"

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

setfileoption("nc","SuppressClose",False)

in1 = addfile("sim1.nc","r")

var1 = in1->VAR1

lon = in1->LON
lat = in1->LAT

landmask = in1->LANDMASK

var1 = mask(var1,landmask,1)

var1!0="pct"
var1!1="lat"
var1!2="lon"

var1&lat@units = "degrees north"
var1&lon@units = "degrees east"

printVarSummary(var1)

in2 = addfile("sim2.nc","r")

var2 = in2->VAR2

var2 = mask(var2,landmask,1)

var2!0="pct"
var2!1="lat"
var2!2="lon"

var2&lat@units = "degrees north"
var2&lon@units = "degrees east"

printVarSummary(var2)
printVarSummary(lon)
printVarSummary(lat)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; Difference of var1 and var2

diff_var1_var2=(/var1-var2/)

diff_var1_var2!0="pct"
diff_var1_var2!1="lat"
diff_var1_var2!2="lon"

copy_VarCoords(var1, diff_var1_var2)
diff_var1_var2&lat@units = "degrees north"
diff_var1_var2&lon@units = "degrees east"
printVarSummary(diff_var1_var2)

....

end
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 25 02:13:08 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 01 2013 - 14:41:44 MDT