[ncl-talk] Error with lat and lon corrdinates
Ipshita Majhi
ipmajhi at alaska.edu
Sun Nov 20 17:17:25 MST 2016
Dear NCL,
I am trying to plot SWE data and the lat lon dimensions don't show up.
I would be grateful if you could guide me on this
*********************************************************
;********************************************
;This is reading in Snow water equivalent which goes from 0 to 250 mm
; from 1982 to 2012
;********************************************
dira = "/Users/ipshita/Desktop/GlobsnowV2.0/version02/"
dirb = dira + "2011/"
;dira = "./"
;dirb = "./"
a = addfile(dira+"monthly_82_13.nc","r")
b = addfile(dirb+"GlobSnow_SWE_L3A_20110101_v2.0.nc","r")
swe = a->swe
time = a->time
lat = b->lat
lon = b->lon
swe at lat2d = lat
swe at lon2d = lon
print(dimsizes(lat))
print(dimsizes(lon))
swe_FillValue=-9.99e+08
utc_date = cd_calendar(time, 0)
year=utc_date(:,0)
month=utc_date(:,1)
;********************************************
;This is to extract 1982-2012 of swe data
;********************************************
swe_82_12=swe(0:371,:,:)
;********************************************
;********************************************
;This is to read in All India Rainfall
;For March , March , June
;********************************************
MJ_1982_2014=asciiread("~/Documents/NCL_files/SST/Monthly/MJ.txt",(/34,1/),"float")
MJ_1982_2012=MJ_1982_2014(0:30,0)
print(dimsizes(MJ_1982_2012))
;*******************************************
;Extracting monthly data for sce
;*******************************************
March_swe = new((/31,721,721/),float)
March_swe at _FillValue = -9.99e+08
do nyr=0,371,12
March_swe(nyr/12,:,:) =swe_82_12(nyr+2,:,:)
end do
;=================================================
March_swe at _FillValue = -9.99e+08
;**********************************************
March_dt =
dtrend_msg(March_swe&time,March_swe(lat|:,lon|:,time|:),True,False)
printMinMax(March_dt,False)
;****************************************
;Calculating Correlation
;***************************************
x1d=ndtooned(MJ_1982_2012)
corr_March=escorc(March_dt,x1d)
corr_March!0="lat"
corr_March!1="lon"
corr_March&lat=lat
corr_March&lon=lon
copy_VarCoords(swe,corr_March)
;**********************************************
;************************************************
; create plot
;************************************************
wks = gsn_open_wks("x11","SWE_March_MJ_correlation_significance")
;
res = True ; Plot modes desired.
res at gsnMaximize = True ; Maximize plot
res at cnFillOn = True ; color plot desired
res at cnFillPalette = "BrownBlue12"
res at cnLinesOn = False ; turn off contour lines
res at pmLabelBarWidthF = 0.9 ; make wider
res at pmLabelBarHeightF = 0.1 ; default is taller
res at lbLabelFontHeightF = .018 ; default is HUGE
;*******************************************
; georeferencing: plot on polar projection
;*******************************************
res at trGridType = "TriangularMesh" ; allow missing coordinates
res at gsnAddCyclic = False
res at cnFillMode = "RasterFill"
res at gsnPolar = "NH" ; specify the hemisphere
res at mpMinLatF = 35
res at tiMainString = "March SWE and MJ correlation"
plot = gsn_csm_contour(wks,corr_March,res)
;*******************************************************
warning:gsnPolar is not a valid resource in
SWE_March_MJ_correlation_significance_contour at this time
warning:mpMinLatF is not a valid resource in
SWE_March_MJ_correlation_significance_contour at this time
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161120/09a70afa/attachment.html
More information about the ncl-talk
mailing list