<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);">
Yes, that fixed the issues! It was much easier than I thought.<br>
<br>
Thank you very much for your help!<br>
<br>
Federico</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> Adam Phillips <asphilli@ucar.edu><br>
<b>Inviato:</b> venerdì 9 luglio 2021 23:55<br>
<b>A:</b> Federico Buscemi - federico.buscemi@studio.unibo.it <federico.buscemi@studio.unibo.it><br>
<b>Cc:</b> Dennis Shea <shea@ucar.edu>; ncl-talk@mailman.ucar.edu <ncl-talk@mailman.ucar.edu><br>
<b>Oggetto:</b> Re: [ncl-talk] R: R: Wrong behaviour of lat/lon coordinates in an interpolated field</font>
<div> </div>
</div>
<div>
<div dir="ltr">Hi Federico,
<div>I don't think there is anything wrong with your specification for the PSL coordinate field. I have modified your script and attached the new script and the result. Note that the original area that you were plotting is much larger than the area that data
 is over, so I zoomed in a bit on the area with data. Also note that you do not really need to plot a blank map first, and overlay the data onto it. Simplifying the graphics portion of your script fixed the issues to my eye. </div>
<div>Hope that helps!</div>
<div>Adam</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Tue, Jul 6, 2021 at 4:58 AM 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)">
<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"></div>
<div style="margin:0px; font-size:12pt"><br>
</div>
<br>
</div>
<div id="x_gmail-m_-4121884462099395510appendonsend"></div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_-4121884462099395510divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Da:</b> Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>><br>
<b>Inviato:</b> martedì 6 luglio 2021 04:50<br>
<b>A:</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>Cc:</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> 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>
<div dir="ltr">On Mon, Jul 5, 2021 at 4:22 PM Federico Buscemi - federico.buscemi--- via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote 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_-4121884462099395510x_gmail-m_6840490195853066305appendonsend">
</div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_-4121884462099395510x_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>
</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>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="x_gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div>
<div><span><font color="#888888">Adam Phillips <br>
</font></span></div>
<span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br>
</font></span></div>
</div>
<div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>  
</font></span><span><font color="#888888">303-497-1726 </font></span></div>
<span><font color="#888888"></font></span>
<div>
<div><span><font color="#888888"><br>
</font></span>
<div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>