<html><body><div id="zimbraEditorContainer" style="font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000" class="1"><div>Hello Mateus,<br></div><div><br data-mce-bogus="1"></div><div>And thank you for your nice e-mail.<br data-mce-bogus="1"></div><div>You are right. I looked again at all the examples and found THE one that suited my problem: <b><a href="http://www.pyngl.ucar.edu/Examples/Scripts/NUG_curvilinear_contour_PyNGL.py" data-mce-href="http://www.pyngl.ucar.edu/Examples/Scripts/NUG_curvilinear_contour_PyNGL.py">NUG_curvilinear_contour_PyNGL.py</a></b><br data-mce-bogus="1"></div><div><b><br data-mce-bogus="1"></b></div><div>So the problem was fixed "simply" by adding the two following lines:<br data-mce-bogus="1"></div><div>res.sfXArray = lon2d #-- longitude grid cell center<br>res.sfYArray = lat2d #-- latitude grid cell center<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>I am very happy and relievd.<br data-mce-bogus="1"></div><div>Thanks again,<br data-mce-bogus="1"></div><div>Have a great day,<br data-mce-bogus="1"></div><div>Kind regards,<br data-mce-bogus="1"></div><div>MD<br data-mce-bogus="1"></div><div><br></div><div data-marker="__SIG_PRE__"><div><span style="color: #0000ff;"><strong><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;">Marie-Dominique LEROUX</span></strong></span><br><span style="color: #0000ff;"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;">—</span><br><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;">Responsable adjointe</span></span></div><div><span style="color: #0000ff;"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;">Division Etudes et Climatologie (</span></span><span style="color: #0000ff;"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;">DIROI/EC)</span></span></div><div><span style="color: #0000ff;"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;">Tel : +262 (0)2 62 92 11 22</span></span></div><div><span style="color: #0000ff;"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;">50 Boulevard du chaudron</span></span></div><div><span style="color: #0000ff;"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;">97491 Sainte Clotilde Cedex</span></span></div><div><br><div><span style="color: #0000ff;"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;">Researcher ID Home Page : </span></span></div><span style="color: #0000ff;"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;"><a href="http://www.researcherid.com/rid/A-9781-2018" title="Researcher ID home page" target="_blank">http://www.researcherid.com/rid/A-9781-2018</a> </span></span></div><div><span style="color: #0000ff;"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;"><a target="_blank" title="Site Internet de Météo-France Réunion" href="http://www.meteofrance.re"><br></a><span class="Object" id="OBJ_PREFIX_DWT7678_com_zimbra_url"><a target="_blank" title="Site Internet de Météo-France Réunion" href="http://www.meteofrance.re"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;"><span style="color: #005091;"><span style="font-family: arial,helvetica,sans-serif; font-size: small;"><span style="font-family: arial,helvetica,sans-serif; font-size: small;"><span class="Object" id="OBJ_PREFIX_DWT3223_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3228_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3475_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3481_com_zimbra_url"><span style="font-size: x-small; color: #005091;"><span class="Object" id="OBJ_PREFIX_DWT7802_com_zimbra_url"></span></span></span></span></span></span></span></span></span></span></a><a target="_blank" title="Site Internet de Météo-France Réunion" href="http://www.meteofrance.re"><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;"><span style="color: #005091;"><span style="font-family: arial,helvetica,sans-serif; font-size: small;"><span style="font-family: arial,helvetica,sans-serif; font-size: small;"><span class="Object" id="OBJ_PREFIX_DWT3223_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3228_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3475_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3481_com_zimbra_url"><span style="font-size: x-small; color: #005091;">www.meteofrance.re</span></span></span></span></span></span></span></span></span></a></span><a href="https://twitter.com/meteofrance" target="_blank" title="Twitter Météo-France"> </a></span></span><br></div><div><br></div><div><a href="http://www.meteofrance.com" target="_blank" title="Site de Météo-France"><img src="cid:5ccdeec3a4ecd8027861b644389c2eaad46e70c1@zimbra" data-mce-src="http://webmail.meteo.fr/home/marie-dominique.leroux@meteo.fr/Briefcase/MFBLEU-RVB.jpg" doc="Briefcase/MFBLEU-RVB.jpg" height="42" width="42"></a><br></div></div><br><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><b>De: </b>"Mateus da Silva Teixeira" <mateusstex@gmail.com><br><b>À: </b>"LEROUX Marie-Dominique" <marie-dominique.leroux@meteo.fr><br><b>Cc: </b>"pyngl-talk" <pyngl-talk@ucar.edu>, "ncl-talk" <ncl-talk@ucar.edu><br><b>Envoyé: </b>Mardi 25 Juin 2019 17:10:40<br><b>Objet: </b>Re: [pyngl-talk] Transiting from NCL to PyNgl and PyNio for a Lambert conformal grid with non-regular lat/lon coordinates<br></div><br><div data-marker="__QUOTED_TEXT__">Hi,<div class=""><br class=""></div><div class="">Did you take a look at the PyNGL examples for WRF data? I think they can help you.</div><div class=""><br class=""></div><div class=""><a href="http://www.pyngl.ucar.edu/Examples/gallery.shtml" class="" target="_blank">http://www.pyngl.ucar.edu/Examples/gallery.shtml</a><br data-mce-bogus="1"></div><div class=""><br class=""></div><div class="">I have similar problems with WRF data in Lambert conformal projection and these examples help me to plot this kind of data.</div><div class=""><br class=""></div><div class="">Best regards,</div><div class=""><br class=""></div><div class="">Mateus</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote class=""><div class="">Em 25 de jun de 2019, à(s) 09:56, LEROUX Marie-Dominique via pyngl-talk <<a href="mailto:pyngl-talk@ucar.edu" class="" target="_blank">pyngl-talk@ucar.edu</a>> escreveu:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="font-family: "times new roman", "new york", times, serif; font-size: 12pt;" class=""><div class="">Dear all,<br class=""></div><div class=""><br class=""></div><div class="">For the past 2 weeks, I have been trying to recode my former NCL scripts (Version 6.5.0) to Python scripts using the PyNio and PyNgl packages and Python 3.7.3.<br class=""></div><div class="">I have a netcdf data file in a Lambert conformal projection with 2-dimensional lat/lon coordinates (not regular).<br class=""></div><div class="">I can't manage to visualize contours on my map plot using the "Ngl.contour_map" command.<br class=""></div><div class="">I am quite certain to know where it comes from since I am able to reproduce this problem with my NCL code when I get rid of 2 lines ( RR@lat2d = lat2d and RR@lon2d = lon2d).<br class=""></div><div class=""><br class=""></div><div class="">I am attaching the python code and the resulting figure to the e-mail and I have already dropped the large netcdf file (11 Mo) on the ftp server (<a href="http://ftp.cgd.ucar.edu" class="" target="_blank">ftp.cgd.ucar.edu</a>).</div><div class="">Its name: SWIO12_CNRM_ESM2_1_HIST_pr_mm_day_1981-2010.AN.nc<br class=""></div><div class=""><br class=""></div><div class="">In my NCL script I have the following lines : <br class=""></div><div class="">; read horizontal coordinates<br class=""> lat2d = a->nav_lat ;(y,x) with: y=10 - x=10<br class=""> lon2d = a->nav_lon<br class=""></div><div class=""> RR = a->pr </div><div class=""> printVarSummary(RR) <br class=""> RR@lat2d = lat2d ; mandatory for plotting<br class=""> RR@lon2d = lon2d ;printVarSummary(RR) <br class=""></div><div class=""> printVarSummary(RR) <br class=""></div><div class=""><br class=""></div><div class=""><strong class="">that adds both attributes lat2d and lon2d to my RR variable so that it plots well</strong></div><div class=""><strong class="">It turns the first PrintVarSummary(RR) :</strong><br class=""></div><div class=""><br class=""></div><div class="">Variable: RR<br class="">Type: float<br class="">Total Size: 15840 bytes<br class=""> 3960 values<br class="">Number of Dimensions: 3<br class="">Dimensions and sizes: [time_counter | 30] x [y | 11] x [x | 12]<br class="">Coordinates: <br class=""> time_counter: [4149790200..5064939000]<br class="">Number Of Attributes: 9<br class=""> long_name : total precipitation<br class=""> units : mm<br class=""> coordinates : nav_lat nav_lon<br class=""> _FillValue : 1e+20<br class=""> missing_value : 1e+20<br class=""> online_operation : average<br class=""> interval_operation : 450 s<br class=""> interval_write : 1 h<br class=""> cell_methods : time: mean (interval: 450 s)<br class=""></div><div class=""><br class=""></div><div class=""><strong class="">--->>> into :</strong> </div><div class=""><br class="">Variable: RR<br class="">Type: float<br class="">Total Size: 15840 bytes<br class=""> 3960 values<br class="">Number of Dimensions: 3<br class="">Dimensions and sizes: [time_counter | 30] x [lat | 11] x [lon | 12]<br class="">Coordinates: <br class=""> time_counter: [4149790200..5064939000]<br class="">Number Of Attributes: 11<br class=""> lon2d : <ARRAY of 132 elements><br class=""> lat2d : <ARRAY of 132 elements><br class=""> long_name : total precipitation<br class=""> units : mm<br class=""> coordinates : nav_lat nav_lon<br class=""> _FillValue : 1e+20<br class=""> missing_value : 1e+20<br class=""> online_operation : average<br class=""> interval_operation : 450 s<br class=""> interval_write : 1 h<br class=""> cell_methods : time: mean (interval: 450 s)<br class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">How can we do that using some Python routines? Set new attributes (lat2d and lon2d) to an existing object or to the numpy array? <br class=""></div><div class="">(I've made some vain trials - commented in the attached script - that write into my Netcdf file and end up with a Core Dump or Memory error)<br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks for your kind help, as I've not find anything helpful on the website examples,<br class=""></div><div class="">Best regards<br class=""></div><div class="">MD<br class=""></div><div class=""><br class=""></div><div class=""><div class=""><span style="color: #0000ff;" class=""><strong class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class="">Marie-Dominique LEROUX</span></strong></span><br class=""><span style="color: #0000ff;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class="">—</span><br class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class="">Responsable adjointe</span></span></div><div class=""><span style="color: #0000ff;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class="">Division Etudes et Climatologie (</span></span><span style="color: #0000ff;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class="">DIROI/EC)</span></span></div><div class=""><span style="color: #0000ff;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class="">Tel : +262 (0)2 62 92 11 22</span></span></div><div class=""><span style="color: #0000ff;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class="">50 Boulevard du chaudron</span></span></div><div class=""><span style="color: #0000ff;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class="">97491 Sainte Clotilde Cedex</span></span></div><div class=""><br class=""><div class=""><span style="color: #0000ff;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class="">Researcher ID Home Page : </span></span></div><span style="color: #0000ff;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class=""><a href="http://www.researcherid.com/rid/A-9781-2018" title="Researcher ID home page" target="_blank" class="">http://www.researcherid.com/rid/A-9781-2018</a> </span></span></div><div class=""><span style="color: #0000ff;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class=""><a target="_blank" title="Site Internet de Météo-France Réunion" href="http://www.meteofrance.re/" class=""><br class=""></a><span class="Object" id="OBJ_PREFIX_DWT7678_com_zimbra_url"><a target="_blank" title="Site Internet de Météo-France Réunion" href="http://www.meteofrance.re/" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class=""><span style="color: #005091;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small;" class=""><span class="Object" id="OBJ_PREFIX_DWT3223_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3228_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3475_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3481_com_zimbra_url"><span style="font-size: x-small; color: #005091;" class=""><span class="Object" id="OBJ_PREFIX_DWT7802_com_zimbra_url"></span></span></span></span></span></span></span></span></span></span></a><a target="_blank" title="Site Internet de Météo-France Réunion" href="http://www.meteofrance.re/" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small; color: #005091;" class=""><span style="color: #005091;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small;" class=""><span style="font-family: arial,helvetica,sans-serif; font-size: small;" class=""><span class="Object" id="OBJ_PREFIX_DWT3223_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3228_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3475_com_zimbra_url"><span class="Object" id="OBJ_PREFIX_DWT3481_com_zimbra_url"><span style="font-size: x-small; color: #005091;" class="">www.meteofrance.re</span></span></span></span></span></span></span></span></span></a></span><a href="https://twitter.com/meteofrance" target="_blank" title="Twitter Météo-France" class=""> </a></span></span><br class=""></div><div class=""><br class=""></div><div class=""><a href="http://www.meteofrance.com/" target="_blank" title="Site de Météo-France" class=""><span id="cid:a865791cbb13f89d6845a6b76eef201a223eb106@zimbra"><MFBLEU-RVB.jpg></span></a><br class=""></div></div></div></div><span id="cid:BD869CF2-1D25-4EC9-8A21-F8D43DD10CAD@ufpel.edu.br"><new_RRsum_talk.py></span>_______________________________________________<br class="">pyngl-talk mailing list<br class="">List instructions, subscriber options, unsubscribe:<br class=""><a href="http://mailman.ucar.edu/mailman/listinfo/pyngl-talk" class="" target="_blank">http://mailman.ucar.edu/mailman/listinfo/pyngl-talk</a><br class=""></div></blockquote></div><br class=""></div><br></div></div></body></html>