<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Xiaoni,<div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><div class=""> 1) To install Pyngl, I followed the suggestion on your website:</div><div class=""> <font color="#831100" class="">conda create --name pyn_test python=2</font></div><div class=""><font color="#831100" class=""> source activate pyn_test</font></div><div class=""><font color="#831100" class=""> conda install --channel ncar --channel khallock pynio pyngl</font></div></div></blockquote></div></div></blockquote><div class=""><br class=""></div><div class="">Everything above looks correct.</div><br class=""><blockquote type="cite" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><div class=""> Then I modified my .bashrc by add the new path : export PATH="/obs/xxw/anaconda2/bin:<font color="#7c2a00" class="">/<wbr class="">obs/xxw/anaconda2/envs/pyn_<wbr class="">test/bin</font>:$PATH"</div></div></blockquote></div></div></blockquote><div class=""><blockquote type="cite" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><div class=""> …</div><div class=""> Then I tried to import Nio, but I have an error: ImportError: No module named Nio</div></div></blockquote></div></div></blockquote></div><div class=""><br class=""></div><div class="">You should not need to explicitly add the /obs/xxw/anaconda2/envs/pyn_test/bin directory to your path; running “source activate pyn_test” does that for you.</div><div class=""><br class=""></div><div class="">In this case, it looks like in addition to adding pyn_test/bin to $PATH manually, the root conda environment has been added to $PATH with a higher priority. Running “which python” will output “/obs/xxw/anaconda2/bin/python”, and that python binary uses the directory “/obs/xxw/anaconda2/lib/python2.7/site-packages” for external modules. Because PyNIO and PyNGL were installed in the pyn_test environment, they do not exist in that directory.</div><div class=""><br class=""></div><div class="">Could you please try modifying your .bashrc file and remove all conda-related commands except for export PATH="/obs/xxw/anaconda2/bin:$PATH”? After doing that, try running “source activate pyn_test” again (the other two conda commands are only necessary when creating/installing PyNIO/PyNGL into a new environment).</div><div class=""><br class=""></div><div class="">Please let us know if you continue to experience issues with conda.</div><div class=""><br class=""></div><div class="">Kevin</div></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 24, 2016, at 11:13 AM, Mary Haley <<a href="mailto:haley@ucar.edu" class="">haley@ucar.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-size:small">Xianoi,</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">I've already replied offline about the conda issues, and I'm hoping Kevin can address these.</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">Meanwhile, with regard to your python script, I think you are on the right track. However, I don't think you want to transpose the data before you plot it. If it is dimensioned latitude x longitude, with latitude being the leftmost dimension, then you don't need to transpose it. If it is dimensioned longitude by latitude, then you need to transpose it.</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">To show the figure on the screen (we call it an "X11 window"), then change "wks_type" to be "x11" instead of "ps". You need to click on the X11 window with your left mouse button if you want the plot to go away.</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">Also, you don't want to set these two options:</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small"><div style="font-size:12.8px" class=""> resources.nglDraw = False</div><div style="font-size:12.8px" class=""> resources.nglFrame = False</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">because these settings would cause your plot to not be drawn at all. Either remove those lines or comment them out. They are both True by default.</div></div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">And yes, once you have all the parameters (we call them "resources") set up, you should be able to use the same ones to plot other data. The tiMainString is probably the only thing you'll need to change.</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">However, if you decide you don't like the contour levels that PyNGL chooses for you, then you might want to change these for your plots. You can look at the cn05p.py for an example of setting contour levels using a min value, max value, and a spacing (for equally spaced contours), or ctnccl.py for example of explicitly setting contour levels to an unequally-spaced array of values.</div>
<div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">Finally, if your data is taking a long time to plot because it is a large array, then you can try setting:</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small"><div style="font-size:12.8px" class=""> resources.cnFillMode = "RasterFill" # default is AreaFill</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">Raster contouring can be noticeably faster than the default "AreaFill", which is smooth contouring. You can also set:</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class=""> resources.cnRasterSmoothingOn = True</div><div style="font-size:12.8px" class=""><br class=""></div><div style="font-size:12.8px" class="">which will smooth your raster contours, but still should be faster than AreaFill.</div></div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">I will attach a Python script that plots the "topo" variable from old and partial ISCCP file that I have. The data on this file is one-dimensional, along with the lat/lon arrays. Here's what a dump of the file looks like:</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace" class=""> file global attributes:</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> description : ISSCP reduced grid</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> dimensions:</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> nodes = 6596</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> variables:</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> float lon ( nodes )</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> units : degrees east</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> long_name : longitude</font></div><div class="gmail_default"><font face="monospace, monospace" class=""><br class=""></font></div><div class="gmail_default"><font face="monospace, monospace" class=""> float lat ( nodes )</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> units : degrees north</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> long_name : latitude</font></div><div class="gmail_default"><font face="monospace, monospace" class=""><br class=""></font></div><div class="gmail_default"><font face="monospace, monospace" class=""> float topo ( nodes )</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> units : meters above sea level (I think)</font></div><div class="gmail_default"><font face="monospace, monospace" class=""> long_name : topology</font></div><div class="gmail_default"><br class=""></div></div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">I'll include the script and the second and third images just in case. I use "png" as the output format.</div><div class="gmail_default" style="font-size:small"><br class=""></div><div class="gmail_default" style="font-size:small">--Mary</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Mon, Oct 24, 2016 at 6:50 AM, Xiaoni Wang <span dir="ltr" class=""><<a href="mailto:xiaoni.wang@obspm.fr" target="_blank" class="">xiaoni.wang@obspm.fr</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Dear colleague,<div class=""> I tried to install Pyngl on my computer in order to draw 2D figures with ISCCP grids. Before this, I had used condo to install python2 and other python tools in /obs/xxwang/anaconda2/.</div><div class=""><br class=""></div><div class=""> 1) To install Pyngl, I followed the suggestion on your website:</div><div class=""> <font color="#831100" class="">conda create --name pyn_test python=2</font></div><div class=""><font color="#831100" class=""> source activate pyn_test</font></div><div class=""><font color="#831100" class=""> conda install --channel ncar --channel khallock pynio pyngl</font></div><div class=""><br class=""></div><div class=""> Then I modified my .bashrc by add the new path : export PATH="/obs/xxw/anaconda2/bin:<font color="#7c2a00" class="">/<wbr class="">obs/xxw/anaconda2/envs/pyn_<wbr class="">test/bin</font>:$PATH »</div><div class=""> I can see the environments:</div><div class=""> pyn_test * /obs/xxw/anaconda2/envs/pyn_<wbr class="">test</div><div class=""> root /obs/xxw/anaconda2</div><div class=""><br class=""></div><div class=""> Then I tried to import Nio, but I have an error: ImportError: No module named Nio</div><div class=""><br class=""></div><div class=""> Could you help me to figure out why ? </div><div class=""><br class=""></div><div class=""> 2) I have another question about using the Pyngl for plotting data on ISCCP grids. Maybe this question would be (too) simple….</div><div class=""><br class=""></div><div class=""> I have my data on ISCCP equal area grids (0.25 degree in latitude, and varying espace in longitude, with more grids near equator and less grids near pole). My data are global data. In my test:</div><div class=""> ISCCP latitude : lat_isccp, 1D, (256915,) ),</div><div class=""> ISCCP longitude: lon_isccp, (1D, (256915,)) </div><div class=""> data: emis (1D , (256915,)). </div><div class=""><br class=""></div><div class=""> I would like to plot emis data on 2D map. I do not know if I should define <span style="white-space:pre-wrap" class="">resources.mpProjection ? </span><span style="white-space:pre-wrap" class="">how to show figure on screen, or h</span><span style="white-space:pre-wrap" class="">ow to save this figure ? or If I have several parameters to plot, I guess that I can use these configurations for all the figures (except </span>resources.tiMainString )<span style="white-space:pre-wrap" class="">? </span></div><div class=""> In the below is my example code for plotting one parameter ‘emis’ . I adapted from your SEAM example.</div><div class=""><br class=""></div><div class=""> wks_type = "ps"</div><div class=""> wks = Ngl.open_wks(wks_type, "isccp")</div><div class=""> resources = Ngl.Resources()</div><div class=""> resources.sfXArray = lon_isccp</div><div class=""> resources.sfYArray = lat_isccp</div><div class=""> resources.nglSpreadColorStart = 176</div><div class=""> resources.nglSpreadColorEnd = 2</div><div class=""> resources.cnFillOn = True</div><div class=""> resources.cnFillMode = "AreaFill"</div><div class=""> resources.cnFillPalette = "BlAqGrYeOrReVi200"</div><div class=""> resources.cnLinesOn = False</div><div class=""> resources.cnLineLabelsOn = False</div><div class=""> resources.lbBoxLinesOn = False</div><div class=""> resources.lbLabelFontHeightF = 0.015</div><div class=""> resources.tiMainString = "Emis"</div><div class=""> resources.nglDraw = False</div><div class=""> resources.nglFrame = False</div><div class=""><br class=""></div><div class=""> zt = np.transpose(emis)</div><div class=""> contour = Ngl.contour(wks,zt,resources)</div><div class=""> <span style="white-space:pre-wrap" class="">Ngl.end()</span></div><div class=""><span style="white-space:pre-wrap" class=""><br class=""></span></div><div class=""><span style="white-space:pre-wrap" class=""> Thank you very much for your help in advance !!</span></div><div class=""><span style="white-space:pre-wrap" class=""><br class=""></span></div><div class=""><span style="white-space:pre-wrap" class=""><br class=""></span></div><div class=""><span style="white-space:pre-wrap" class="">Best regards</span></div><div class=""><span style="white-space:pre-wrap" class=""><br class=""></span></div><div class=""><span style="white-space:pre-wrap" class="">Xiaoni W</span></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""> </div><div class=""> </div><div class=""> </div></div><br class="">______________________________<wbr class="">_________________<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" rel="noreferrer" target="_blank" class="">http://mailman.ucar.edu/<wbr class="">mailman/listinfo/pyngl-talk</a><br class="">
<br class=""></blockquote></div><br class=""></div>
<span id="cid:2820E7CE-8A67-4259-A048-F2A40ED85790@scd.ucar.edu"><isccp3.png></span><span id="cid:703E0116-17FF-4753-8D03-68661533207A@scd.ucar.edu"><isccp2.png></span><span id="cid:A64183EB-BA66-4EB4-AE1B-E222E845EA1F@scd.ucar.edu"><isccp.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>