<div dir="ltr"><div><div>Hi,<br>I added these lines . Then also same error. <br>grid!0="lat"<br>grid!1="lon"<br>grid&lat = latt <br>grid&lon = lonn<br>grid&lat@units="degrees_north"<br>grid&lon@units="degrees_east"<br><br></div>Could you please help me to fix this isssue. <br><br></div>Thank you<br><div><div><br><br><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 18, 2015 at 2:41 AM, Karin Meier-Fleischer <span dir="ltr"><<a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi Adv,<br>
<br>
have you read the warning messages NCL returned? Your latitude and
longitude arrays do not have the correct units like degrees_north or
degrees_east. The solution is to add the units attribute to lat and
lon, so NCL will know how to handle them.<br>
<br>
lat@units = "degrees_north"<br>
lon@units = "degrees_east"<br>
<br>
Bye,<br>
Karin<br>
<br>
<div>Am 18.12.15 um 08:24 schrieb Adv:<br>
</div>
<blockquote type="cite"><div><div class="h5">
<div dir="ltr">
<div>
<div>Hi,<br>
</div>
I have been trying to do objective analysis only over the
region of longitude from -116 to -90.35 and latitude of 40.01
to 49. While plotting the output, the values are spreaded over
the global region. I don't understand where is wrong. It's
been long I am kinda stuck with this objective analysis. I
have attached here the output figure and code too. Could
someone please help me to fix this? <br>
<br>
begin<br>
strll = asciiread("stationmac.txt", -1, "string") ;<br>
print(strll) ; STATION","STATION_NAME", "LAT", "LON"<br>
print("=====")<br>
<br>
sloc = str_get_field(strll , 2, ",")<br>
lat = tofloat( str_get_field(strll , 3, ",") )<br>
lon = tofloat( str_get_field(strll , 4, ",") )<br>
print(sloc +" : "+lat+" "+lon)<br>
mnlat=(min(lat))<br>
mxlat=(max(lat))<br>
mnlon=(min(lon))<br>
mxlon=(max(lon))<br>
;print(lon)<br>
print(mnlon)<br>
print(mxlon)<br>
print(mnlat)<br>
print(mxlat)<br>
mlon = 390<br>
dlon = -90.35 / mlon<br>
lonn = fspan (-116, (mlon - 1) * dlon, mlon)<br>
print(lonn)<br>
mlat = 390<br>
dlat = 49.0 / mlat<br>
latt = fspan (40.01, (mlat - 1) * dlat, mlat)<br>
print(latt)<br>
;gcdist = gc_latlon(mnlat,mnlon, mxlat,mxlon, 300,2)<br>
;print(gcdist)<br>
;print (gcdist@gclat+" "+gcdist@gclon )<br>
;return<br>
;latt=gcdist@gclat<br>
;lonn=gcdist@gclon<br>
;print(min(latt))<br>
;print(max(latt))<br>
;print(max(lonn))<br>
;print(min(lonn))<br>
diri="/home/dailysimms/prec-obs/01/"<br>
z1 = asciiread(diri+"PrecJan1965-2014",-1,"float")<br>
;print(z1)<br>
;printVarSummary(z1)<br>
;a = (/1,2,3,4,5,6,7,8/)<br>
;390 rows by 50 columns<br>
a0 = onedtond(z1,(/390,50/))<br>
;print(a0)<br>
x=dim_avg(a0)<br>
print(x)<br>
set_default_fillvalue("string", "")<br>
zi = natgrid(lon, lat, x, lonn, latt)<br>
print(zi)<br>
zi!0="lat"<br>
zi!1="lon"<br>
zi&lat=latt<br>
zi&lon=lonn<br>
printVarSummary(zi)<br>
print(zi)<br>
opt = True<br>
opt@timing = True<br>
rscan = (/20,15,10, 5,3 /)<br>
grid = obj_anal_ic_deprecated(lon, lat, x, lonn, latt,
rscan, opt)<br>
printVarSummary(grid)<br>
print(grid)<br>
print(min(grid))<br>
print(max(grid))<br>
grid!0="lt"<br>
grid!1="ln"<br>
grid&lt=latt<br>
grid&ln=lonn<br>
printVarSummary(grid)<br>
;return<br>
;------------------------------------------------------------------<br>
; plot<br>
;------------------------------------------------------------------<br>
wks = gsn_open_wks("pdf","rdm2grid")<br>
gsn_define_colormap(wks,"amwg")<br>
plot = new(2,graphic)<br>
<br>
res = True<br>
res@gsnDraw = False ; don't draw<br>
res@gsnFrame = False ; don't advance
frame<br>
res@cnFillOn = True ; turn on color<br>
;res@cnLinesOn = False ; turn off contour
lines<br>
res@cnLineLabelsOn = False ; turn off contour
line labels<br>
res@gsnSpreadColors = True ; spread out color
table<br>
res@lbLabelBarOn = False ; turn off
individual cb's<br>
<br>
<br>
res@gsnCenterString = "Original grid"<br>
plot(0) = gsn_csm_contour_map_ce(wks,zi,res)<br>
<br>
plot(1) = gsn_csm_contour_map_ce(wks,grid,res)<br>
;************************************************<br>
; create panel<br>
;************************************************<br>
resP = True ; modify the
panel plot<br>
;resP@txString = title<br>
resP@gsnMaximize = True ; make large<br>
resP@gsnPanelLabelBar = True ; add common
colorbar<br>
resP@lbLabelAutoStride = True ; Let NCL
decide spacing<br>
;resP@lbLabelStride = 2 ; force every
other label<br>
;resP@lbLabelFontHeightF = 0.0125 ; make labels
smaller [0.2 default]<br>
<br>
gsn_panel(wks,plot,(/2,1/),resP) ; now draw as
one plot<br>
<br>
end<br>
<br>
</div>
Warning message:<br>
(0) check_for_y_lat_coord: Warning: Data either does not
contain a valid latitude coordinate array or doesn't contain one
at all.<br>
(0) A valid latitude coordinate array should have a 'units'
attribute equal to one of the following values: <br>
(0) 'degrees_north' 'degrees-north' 'degree_north'
'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN'
'degreesN' 'deg north'<br>
(0) check_for_lon_coord: Warning: Data either does not
contain a valid longitude coordinate array or doesn't contain
one at all.<br>
(0) A valid longitude coordinate array should have a 'units'
attribute equal to one of the following values: <br>
(0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees
east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE'
'deg east'<br>
(0) check_for_y_lat_coord: Warning: Data either does not
contain a valid latitude coordinate array or doesn't contain one
at all.<br>
(0) A valid latitude coordinate array should have a 'units'
attribute equal to one of the following values: <br>
(0) 'degrees_north' 'degrees-north' 'degree_north'
'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN'
'degreesN' 'deg north'<br>
(0) check_for_lon_coord: Warning: Data either does not
contain a valid longitude coordinate array or doesn't contain
one at all.<br>
(0) A valid longitude coordinate array should have a 'units'
attribute equal to one of the following values: <br>
(0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees
east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE'
'deg east'<br>
<br>
<div><br>
<br>
<br>
<br>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
</div></div><pre>_______________________________________________
ncl-talk mailing list
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>
List instructions, subscriber options, unsubscribe:
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a>
</pre>
</blockquote>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>