<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">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="">http://www.pyngl.ucar.edu/Examples/gallery.shtml</a></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 type="cite" 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="">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 data-mce-bogus="1" 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 data-mce-bogus="1" class=""></div><div class="">I have a netcdf data file in a Lambert conformal projection with 2-dimensional lat/lon coordinates (not regular).<br data-mce-bogus="1" class=""></div><div class="">I can't manage to visualize contours on my map plot using the "Ngl.contour_map" command.<br data-mce-bogus="1" 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 data-mce-bogus="1" class=""></div><div class=""><br data-mce-bogus="1" 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="">ftp.cgd.ucar.edu</a>).</div><div class="">Its name: SWIO12_CNRM_ESM2_1_HIST_pr_mm_day_1981-2010.AN.nc<br data-mce-bogus="1" class=""></div><div class=""><br class=""></div><div class="">In my NCL script I have the following lines : <br data-mce-bogus="1" 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 data-mce-bogus="1" 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 data-mce-bogus="1" class=""></div><div class=""> printVarSummary(RR) <br data-mce-bogus="1" class=""></div><div class=""><br data-mce-bogus="1" 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 data-mce-bogus="1" class=""></div><div class=""><br data-mce-bogus="1" 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 data-mce-bogus="1" 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 data-mce-bogus="1" class=""></div><div class=""><br data-mce-bogus="1" class=""></div><div class=""><br data-mce-bogus="1" 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 data-mce-bogus="1" 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 data-mce-bogus="1" class=""></div><div class=""><br data-mce-bogus="1" class=""></div><div class=""><br data-mce-bogus="1" class=""></div><div class="">Thanks for your kind help, as I've not find anything helpful on the website examples,<br data-mce-bogus="1" class=""></div><div class="">Best regards<br data-mce-bogus="1" class=""></div><div class="">MD<br data-mce-bogus="1" class=""></div><div class=""><br data-mce-bogus="1" class=""></div><div data-marker="__SIG_PRE__" 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="">http://mailman.ucar.edu/mailman/listinfo/pyngl-talk</a><br class=""></div></blockquote></div><br class=""></div></body></html>