<html><body><div style="font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000"><div>Dear all,<br></div><div><br data-mce-bogus="1"></div><div>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 data-mce-bogus="1"></div><div>I have a netcdf data file in a Lambert conformal projection with 2-dimensional lat/lon coordinates (not regular).<br data-mce-bogus="1"></div><div>I can't manage to visualize contours on my map plot using the "Ngl.contour_map" command.<br data-mce-bogus="1"></div><div>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 data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>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 (ftp.cgd.ucar.edu).</div><div>Its name:   SWIO12_CNRM_ESM2_1_HIST_pr_mm_day_1981-2010.AN.nc<br data-mce-bogus="1"></div><div><br></div><div>In my NCL script I have the following lines : <br data-mce-bogus="1"></div><div>; read horizontal coordinates<br>  lat2d      = a->nav_lat        ;(y,x) with:  y=10 - x=10<br>  lon2d      = a->nav_lon<br data-mce-bogus="1"></div><div>  RR        = a->pr          </div><div> printVarSummary(RR)    <br>  RR@lat2d = lat2d                ; mandatory for plotting<br>  RR@lon2d = lon2d             ;printVarSummary(RR)    <br data-mce-bogus="1"></div><div> printVarSummary(RR)    <br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><strong>that adds both attributes lat2d and lon2d to my RR variable so that it plots well</strong></div><div><strong>It turns the first PrintVarSummary(RR)  :</strong><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Variable: RR<br>Type: float<br>Total Size: 15840 bytes<br>            3960 values<br>Number of Dimensions: 3<br>Dimensions and sizes:    [time_counter | 30] x [y | 11] x [x | 12]<br>Coordinates: <br>            time_counter: [4149790200..5064939000]<br>Number Of Attributes: 9<br>  long_name :    total precipitation<br>  units :    mm<br>  coordinates :    nav_lat nav_lon<br>  _FillValue :    1e+20<br>  missing_value :    1e+20<br>  online_operation :    average<br>  interval_operation :    450 s<br>  interval_write :    1 h<br>  cell_methods :    time: mean (interval: 450 s)<br></div><div><br data-mce-bogus="1"></div><div><strong>--->>> into :</strong> </div><div><br>Variable: RR<br>Type: float<br>Total Size: 15840 bytes<br>            3960 values<br>Number of Dimensions: 3<br>Dimensions and sizes:    [time_counter | 30] x [lat | 11] x [lon | 12]<br>Coordinates: <br>            time_counter: [4149790200..5064939000]<br>Number Of Attributes: 11<br>  lon2d :    <ARRAY of 132 elements><br>  lat2d :    <ARRAY of 132 elements><br>  long_name :    total precipitation<br>  units :    mm<br>  coordinates :    nav_lat nav_lon<br>  _FillValue :    1e+20<br>  missing_value :    1e+20<br>  online_operation :    average<br>  interval_operation :    450 s<br>  interval_write :    1 h<br>  cell_methods :    time: mean (interval: 450 s)<br><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>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 data-mce-bogus="1"></div><div>(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 data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Thanks for your kind help, as I've not find anything helpful on the website examples,<br data-mce-bogus="1"></div><div>Best regards<br data-mce-bogus="1"></div><div>MD<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></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:a865791cbb13f89d6845a6b76eef201a223eb106@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></div></body></html>