Assignment Type Mismatch

From: Taylor Hughlett <taylor.hughlett_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 10 2013 - 11:31:41 MDT

Good afternoon,

I am having an issue with the following ncl program, which I am using to calculate freshwater input for the Northern Atlantic. I get the following error:

fatal:["NclVar.c":1382]:Assignment type mismatch, right hand side can't be coerced to type of left hand side
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 56 in file ccsm_cmip_noHudsonsBay_noNorthSea.ncl

The following is the program:

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"

;****************************************************************
begin
;**************************
; open file and read in monthly data
;**************************

path = "/glade/scratch/hughlett/csm/b30yd.013_1fwDVT/ocn/tavg/"
f = addfile(path+"b30yd.013_1fwDVT.pop.h.1790.nc","r")
tarea = f->TAREA
ht = f->HT
tlat = f->TLAT
tlon = f->TLONG

printVarSummary(ht)
printVarSummary(tarea)

popmask=new((/384,320/),integer)

;define a mask for the north Atlantic basin which is the area between
;50N-70N and 14E-80W
popmask=0
do i=0,99
  do j=0,115
  if (ht(j,i).gt.0).and.(tlat(j,i).ge.50.).and.(tlat(j,i).le.70.) then
   if (tlon(j,i).le.14).or.(tlon(j,i).ge.280) then
  popmask(j,i)=0
   end if
  end if
  end do
end do

; array for the 1 SV fresh water flux
; compute area of ocean for fresh water flux
icc=116*100
freshflux=new(icc,double)
cc=0
 do i=0,99
   do j=0,115
   if (popmask(j,i).eq.5) then
     cc=cc+tarea(j,i)
   end if
   end do
 end do

print(tarea)

; area in cm^2 units- convert to m^2
cc=cc/1.e4

; fresh water flux value for 1 Sv
 fresh=1.0e6*1.e3/cc ;m/s --> kg/m^2/s

print(cc)
print(fresh)

mask0=tarea
mask1=mask(mask0,(ht.gt.0.),True)
mask2=mask(mask1,(tlat.ge.50.),True)
mask3=mask(mask2,(tlat.le.70.),True)
mask4=mask(mask3,(tlon.le.14.),True)
mask5=mask(mask3,(tlon.ge.280.),True)

printVarSummary(mask4)
printVarSummary(mask5)

wks=gsn_open_wks("ps","ccsm_pop_na_mask1")
res = True
 res@cnFillOn = True ; turn on color
 res@gsnSpreadColors = True ; use full color map
 res@cnLinesOn = False ; no contour lines
 res@cnLineLabelsOn = False ; no line labels
  cmap = "temp_19lev"
  gsn_define_colormap(wks,cmap)
 plot=gsn_csm_contour(wks,tlat,res)
 plot=gsn_csm_contour(wks,tlon,res)
 plot=gsn_csm_contour(wks,mask1,res)
 plot=gsn_csm_contour(wks,mask5,res)
 plot=gsn_csm_contour(wks,popmask,res)

end

Any help with this issue would be greatly appreciated.

Thanks,
Taylor Hughlett

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 10 11:31:53 2013

This archive was generated by hypermail 2.1.8 : Tue Jun 11 2013 - 12:03:58 MDT