<div dir="ltr"><div>Hi Karin,</div><div><br></div><div>Thank you for your answer.</div><div><br></div><div>Yes, I already had seen that and I have used it like you wrote. <br></div><div><br></div><div>However, I think that would be great for PyNGL if it could take all information for graphics (coords, attributes etc) from a xarray.DataArray, like NCL does (with variables that have coordinates), without we have to provide coordinates information via resources. <br></div><div><br></div><div>So, if here is a place to make suggestions, it would be a great feature of PyNGL.</div><div><br></div><div>Best regards,</div><div>Mateus</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em qua, 27 de mar de 2019 às 13:12, Karin Meier-Fleischer via pyngl-talk <<a href="mailto:pyngl-talk@ucar.edu">pyngl-talk@ucar.edu</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#ffffff">
    HI Mateus,<br>
    <br>
    you can use xarray already you have to add .values to the
    sfXArray/sfYArray resources.<br>
    <br>
    <font color="#3333ff"><tt>lat = xr.open_dataset('your_file').lat</tt><tt><br>
      </tt><tt>lon = xr.open_dataset('your_file').lon</tt><tt><br>
      </tt><tt>...</tt><tt><br>
      </tt><tt>res.sfXArray = lon.values</tt><tt><br>
      </tt><tt>res.sfYArray = lat.values</tt></font><br>
    <br>
    lon.values will give you the xarray data array lon as a numpy array.
    <br>
    See also
    <a href="http://xarray.pydata.org/en/stable/generated/xarray.DataArray.values.html" target="_blank">xarray.pydata.org/en/stable/generated/xarray.DataArray.values.html</a><br>
    <br>
    Bye<br>
    Karin<br>
    <br>
    <div class="gmail-m_8149667415787943563moz-cite-prefix">Am 27.03.19 um 14:14 schrieb Mateus da
      Silva Teixeira via pyngl-talk:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>Hi,</div>
        <div><br>
        </div>
        <div>I'm beginning to use Python since the news about NCL is
          being placed in maintenance mode, and since it was said that
          PyNIO will also be placed in maintenance mode, I'm using other
          libraries to open data files and PyNGL for graphics.</div>
        <div><br>
        </div>
        <div>Reading about Ngl.contour_map(), I found that it expects a
          numpy array with data to plot and coordinates information are
          given to sfXArray and sfYArray resources.</div>
        <div><br>
        </div>
        <div>Is there a plan to use xarray.DataArray as a data model for
          PyNGL? It has large similarities with NCL's variable model,
          which is borrowed from netCDF model.</div>
        <div><br>
        </div>
        <div>I'm asking it because it seems more natural to use xarray,
          which contains all metadata for a variable, than use a numpy
          array.</div>
        <div><br>
        </div>
        <div>Thanks and excuse me if it's a already defined topic in
          future development of PyNGL.</div>
        <div><br>
        </div>
        <div>Best regards,</div>
        <div><br>
        </div>
        <div>Mateus</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <fieldset class="gmail-m_8149667415787943563mimeAttachmentHeader"></fieldset>
      <pre class="gmail-m_8149667415787943563moz-quote-pre">_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
<a class="gmail-m_8149667415787943563moz-txt-link-freetext" href="http://mailman.ucar.edu/mailman/listinfo/pyngl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/pyngl-talk</a>
</pre>
    </blockquote>
    <br>
  </div>

_______________________________________________<br>
pyngl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/pyngl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/pyngl-talk</a><br>
</blockquote></div>