<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="margin:0px;font-size:12pt">Thank you for your help, Dennis.</span>
<div style="margin:0px;font-size:12pt"><br>
</div>
<div style="margin:0px;font-size:12pt">I had already noticed the absence of some values ​​in the last column, in fact I had temporarily used only row 263 in my script, randomly chosen among those in which there were no missing values. That would have been a
 problem that I would have faced later.
<div style="margin:0px"><br>
</div>
I apologize but I have probably explained myself badly. I have no problem with the position of the wind barbs on the map. Their position corresponds to the real position of the stations. Instead I have problems with the interpolated sea level pressure field.
 I suppose the problem lies in this part of the code, where the lat / lon coordinates are assigned to the "p_int_real" variable:<br>
<br>
 <i><span> </span>xo = fspan(11.8000, 12.8000, 4000)</i>
<div style="margin:0px"><i>  yo = fspan(44.8000, 45.4000, 2400)</i></div>
<div style="margin:0px"><i><br>
</i></div>
<div style="margin:0px"><i>  yo@units = "degrees_north"</i></div>
<div style="margin:0px"><i>  xo@units = "degrees_east"</i></div>
<div style="margin:0px"><i><br>
</i></div>
<div style="margin:0px"><i>  yo!0 = "lat"</i></div>
<div style="margin:0px"><i>  xo!0 = "lon"</i></div>
<div style="margin:0px"><i>  yo@axis = "Y"</i></div>
<div style="margin:0px"><i>  xo@axis = "X"</i></div>
<div style="margin:0px"><i> </i></div>
<div style="margin:0px"><i>  p_int = natgrid(x, y, z, xo, yo)</i></div>
<div style="margin:0px"><i>  p_int_real = transpose(p_int)</i></div>
<div style="margin:0px"><i><br>
</i></div>
<div style="margin:0px"><i>  p_int_real!0 = "lat"</i></div>
<div style="margin:0px"><i>  p_int_real!1 = "lon"</i></div>
<div style="margin:0px"><i><br>
</i></div>
<div style="margin:0px"><i>  p_int_real&lat = yo</i></div>
<div style="margin:0px"><i>  p_int_real&lon = xo</i></div>
<div style="margin:0px"><i><br>
</i></div>
<div style="margin:0px"><i>  p_int_real&lat@units = "degrees_north"</i></div>
<div style="margin:0px"><i>  p_int_real&lon@units = "degrees_east"</i></div>
<div style="margin:0px"><br>
</div>
<div style="margin:0px">There must be something I got wrong because it is as if the assignment doesn't actually happen.<br>
</div>
</div>
<div style="margin:0px;font-size:14px;font-family:"Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif">
</div>
<div style="margin:0px;font-size:12pt"><br>
</div>
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Da:</b> Dennis Shea <shea@ucar.edu><br>
<b>Inviato:</b> martedì 6 luglio 2021 04:50<br>
<b>A:</b> Federico Buscemi - federico.buscemi@studio.unibo.it <federico.buscemi@studio.unibo.it><br>
<b>Cc:</b> ncl-talk@mailman.ucar.edu <ncl-talk@mailman.ucar.edu><br>
<b>Oggetto:</b> Re: [ncl-talk] R: Wrong behaviour of lat/lon coordinates in an interpolated field</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Currently, I don't have the time to look at the coding in detail.</div>
<div>I am going to suggest that you work with a scalar field like pressure to debug this code.</div>
<div>Then add the wind components.<br>
</div>
<div><br>
</div>
<div>I did look at the text files. In many of the files the last value is not present. For example:<br>
</div>
<div><br>
</div>
<div>vento_direzione_201911.TXT</div>
<div><br>
</div>
<div>The 1st 3 lines<br>
</div>
<div><br>
</div>
<div>12/11/19;00:00;39;42;53;60;35;47;33;272;359<br>
</div>
<div>12/11/19;00:05;37;40;51;60;32;48;31;111;               <=== last value is missing [MANY warning messages]<br>
</div>
<div>12/11/19;00:10;35;43;48;64;36;48;30;356;23</div>
<div><br>
</div>
<div>I added some code to eliminate Warning messages<br>
</div>
<div><br>
</div>
<div>The attached script illustrates some of the issues.</div>
<div><br>
</div>
<div>%> ncl debug_3.ncl  |  less<br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Mon, Jul 5, 2021 at 4:22 PM Federico Buscemi - federico.buscemi--- via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hello,<br>
I hope you can see it now. Thank you.</div>
<div id="x_gmail-m_6840490195853066305appendonsend"></div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_6840490195853066305divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Da:</b> Federico Buscemi -
<a href="mailto:federico.buscemi@studio.unibo.it" target="_blank">federico.buscemi@studio.unibo.it</a> <<a href="mailto:federico.buscemi@studio.unibo.it" target="_blank">federico.buscemi@studio.unibo.it</a>><br>
<b>Inviato:</b> lunedì 5 luglio 2021 23:01<br>
<b>A:</b> <a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a> <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>><br>
<b>Oggetto:</b> Wrong behaviour of lat/lon coordinates in an interpolated field</font>
<div> </div>
</div>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">Dear all,</span><br>
</div>
<div>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
I am having some trouble with my script, copied and pasted below. I interpolated sea level pressure values (z), read from two of the attached text files, recorded in six locations around Venezia, Italy. I wanted to plot the interpolated field in the Venezia
 Lagoon area. Even if values are well interpolated by means of "natgrid" function, it seems that they are not associated with latitude and longitude coordinates, since contours are always drawn in the same way, although I vary<span style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt"> lat/lon
 coordinates of the map. Since I don't get errors in my output, I don't know how to solve this issue. I tried in several ways, but still can't figure it out. Any suggestion would be appreciated. Thank you.<br>
<br>
Federico Buscemi </span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<div>begin</div>
<div><br>
</div>
<div>  fname1 = "filetxt/vento_direzione_201911.TXT"</div>
<div>  fname2 = "filetxt/vento_velocita_201911.TXT"</div>
<div>  fname3 = "filetxt/Vento_Direzione_ISPRA.txt"</div>
<div>  fname4 = "filetxt/Vento_Velocità_ISPRA.txt"</div>
<div>  fname5 = "filetxt/pressione_201911.TXT"</div>
<div>  fname6 = "filetxt/Pressioni_ISPRA.txt"</div>
<div>  lines1 = asciiread(fname1,-1,"string")</div>
<div>  lines2 = asciiread(fname2,-1,"string")</div>
<div>  lines3 = asciiread(fname3,-1,"string")</div>
<div>  lines4 = asciiread(fname4,-1,"string")</div>
<div>  lines5 = asciiread(fname5,-1,"string")</div>
<div>  lines6 = asciiread(fname6,-1,"string")</div>
<div><br>
</div>
<div>  delim = ";"</div>
<div>  ndata = str_fields_count(lines1, delim)</div>
<div>   </div>
<div>  date = str_get_field(lines1, 1, delim)</div>
<div>  time = str_get_field(lines1, 2, delim)</div>
<div><br>
</div>
<div>  dpiatt = stringtoint(str_get_field(lines1, 3, delim))</div>
<div>  dmalpor = stringtoint(str_get_field(lines1, 6, delim))</div>
<div>  dchipor = stringtoint(str_get_field(lines1, 7, delim))</div>
<div>  dsang = stringtoint(str_get_field(lines1, 9, delim))</div>
<div>  dmeab = stringtoint(str_get_field(lines1, 11, delim))</div>
<div>  dpame = stringtoint(str_get_field(lines3, 3, delim))</div>
<div>  dfopo = stringtoint(str_get_field(lines3, 5, delim))</div>
<div><br>
</div>
<div>  vpiatt = stringtofloat(str_get_field(lines2, 3, delim))</div>
<div>  vmalpor = stringtofloat(str_get_field(lines2, 6, delim))</div>
<div>  vchipor = stringtofloat(str_get_field(lines2, 7, delim))</div>
<div>  vsang = stringtofloat(str_get_field(lines2, 9, delim))</div>
<div>  vmeab = stringtofloat(str_get_field(lines2, 11, delim))</div>
<div>  vpame = stringtofloat(str_get_field(lines4, 3, delim))</div>
<div>  vfopo = stringtofloat(str_get_field(lines4, 5, delim))</div>
<div><br>
</div>
<div>  ppiatt = stringtofloat(str_get_field(lines5, 3, delim))</div>
<div>  ppaca = stringtofloat(str_get_field(lines5, 4, delim))</div>
<div>  pmeab = stringtofloat(str_get_field(lines5, 5, delim))</div>
<div>  ppame = stringtofloat(str_get_field(lines6, 3, delim))</div>
<div>  pfopo = stringtofloat(str_get_field(lines6, 4, delim))</div>
<div>  plime = stringtofloat(str_get_field(lines6, 5, delim))</div>
<div><br>
</div>
<div>  wpiatt = wind_component(vpiatt,dpiatt,0)</div>
<div>  wmalpor = wind_component(vmalpor,dmalpor,0)</div>
<div>  wchipor = wind_component(vchipor,dchipor,0)</div>
<div>  wsang = wind_component(vsang,dsang,0)</div>
<div>  wmeab = wind_component(vmeab,dmeab,0)</div>
<div>  wpame = wind_component(vpame,dpame,0)</div>
<div>  wfopo = wind_component(vfopo,dfopo,0)</div>
<div><br>
</div>
<div>  latpiatt = 45.3142417</div>
<div>  lonpiatt = 12.5083139</div>
<div>  latmalpor = 45.3398</div>
<div>  lonmalpor = 12.2919667</div>
<div>  latchipor = 45.2325389</div>
<div>  lonchipor = 12.2805972</div>
<div>  latsang = 45.4284083</div>
<div>  lonsang = 12.3462639</div>
<div>  latmeab = 45.235</div>
<div>  lonmeab = 12.7716667</div>
<div>  latpame = 45.4027694</div>
<div>  lonpame = 11.8585417</div>
<div>  latfopo = 44.8438333</div>
<div>  lonfopo = 12.4624028</div>
<div>  latpaca = 45.4364324</div>
<div>  lonpaca = 12.3335352</div>
<div>  latlime = 45.43015</div>
<div>  lonlime = 12.38295</div>
<div><br>
</div>
<div>  x = (/lonpame, lonfopo, lonpiatt, lonmeab, lonpaca, lonlime/)</div>
<div>  y = (/latpame, latfopo, latpiatt, latmeab, latpaca, latlime/)</div>
<div>  z = (/ppame(263), pfopo(263), ppiatt(263), pmeab(263), ppaca(263), plime(263)/)</div>
<div><br>
</div>
<div>  xo = fspan(11.8000, 12.8000, 4000)</div>
<div>  yo = fspan(44.8000, 45.4000, 2400)</div>
<div><br>
</div>
<div>  yo@units = "degrees_north"</div>
<div>  xo@units = "degrees_east"</div>
<div><br>
</div>
<div>  yo!0 = "lat"</div>
<div>  xo!0 = "lon"</div>
<div>  </div>
<div>  p_int = natgrid(x, y, z, xo, yo) </div>
<div>  p_int_real = transpose(p_int)</div>
<div><br>
</div>
<div>  p_int_real!0 = "lat"</div>
<div>  p_int_real!1 = "lon"</div>
<div><br>
</div>
<div>  p_int_real&lat = yo</div>
<div>  p_int_real&lon = xo</div>
<div><br>
</div>
<div>  p_int_real&lat@units = "degrees_north"</div>
<div>  p_int_real&lon@units = "degrees_east"</div>
<div><br>
</div>
<div><br>
</div>
<div>  wks = gsn_open_wks("pdf","station")       ; send graphics to PNG file</div>
<div><br>
</div>
<div>  mpres = True</div>
<div>  mpres@gsnFrame = False</div>
<div>  mpres@mpLimitMode = "LatLon"</div>
<div>  mpres@mpMinLatF                   = 40.5</div>
<div>  mpres@mpMinLonF                   = 10</div>
<div>  mpres@mpMaxLatF                   = 48.8</div>
<div>  mpres@mpMaxLonF                   = 15.8</div>
<div>  mpres@mpDataBaseVersion = "HighRes"</div>
<div>  mpres@mpOutlineBoundarySets = "AllBoundaries"</div>
<div>  mpres@gsnMaximize = True</div>
<div><br>
</div>
<div>  map = gsn_csm_map(wks,mpres)</div>
<div>  </div>
<div>  cnres = True</div>
<div>  cnres@gsnAddCyclic = False</div>
<div>  cnres@gsnFrame = False</div>
<div>  cnres@cnFillOn = False</div>
<div>  cnres@cnLinesOn = True</div>
<div>  cnres@cnInfoLabelOn = False</div>
<div>  cnres@cnLevelSelectionMode = "ManualLevels"</div>
<div>  cnres@cnMinLevelValF = 980.0</div>
<div>  cnres@cnMaxLevelValF = 1010.0</div>
<div>  cnres@cnLevelSpacing = .5</div>
<div>  cnres@cnFillDrawOrder = "PreDraw"</div>
<div>  cnres@cnLineLabelsOn = True</div>
<div>  cnres@cnLineLabelPlacementMode = "Constant"</div>
<div>;  cnres@sfXArray            = xo</div>
<div>;  cnres@sfYArray            = yo</div>
<div><br>
</div>
<div>  cnres@tmXBBorderOn = False</div>
<div>  cnres@tmXBOn = False</div>
<div>  cnres@tmXTBorderOn = False</div>
<div>  cnres@tmXTOn = False</div>
<div>  cnres@tmYLBorderOn = False</div>
<div>  cnres@tmYLOn = False</div>
<div>  cnres@tmYRBorderOn = False</div>
<div>  cnres@tmYROn = False</div>
<div><br>
</div>
<div><br>
</div>
<div>  wmsetp("wbs", .045)</div>
<div><br>
</div>
<div>  wmbarbmap(wks, latpiatt, lonpiatt, wpiatt(0,263), wpiatt(1,263))</div>
<div>  wmbarbmap(wks, latsang, lonsang, wsang(0,263), wsang(1,263))</div>
<div>  wmbarbmap(wks, latmalpor, lonmalpor, wmalpor(0,263), wmalpor(1,263))</div>
<div>  wmbarbmap(wks, latchipor, lonchipor, wchipor(0,263), wchipor(1,263))</div>
<div>  wmbarbmap(wks, latmeab, lonmeab, wmeab(0,263), wmeab(1,263))</div>
<div>  wmbarbmap(wks, latpame, lonpame, wpame(0,263), wpame(1,263))</div>
<div>  wmbarbmap(wks, latfopo, lonfopo, wfopo(0,263), wfopo(1,263))</div>
<div><br>
</div>
<div>  cnp = gsn_csm_contour(wks,p_int_real,cnres)</div>
<div><br>
</div>
<div>  overlay(map,cnp)</div>
<div><br>
</div>
<span>end </span><br>
</div>
</div>
</div>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
</div>
</div>
</body>
</html>