[Tutor] Overlay Quiver Plot on Contours
Hello, I have the following script: import netCDF4 import numpy as np import matplotlib.pyplot as plt import pylab ncfile = netCDF4.Dataset('30JUNE2012_0300UTC.cdf', 'r') dbZ = ncfile.variables['MAXDBZF'] data = dbZ[0,0] data.shape x = np.array([0,10,11]) y = np.array([0,15,16]) X,Y = np.meshgrid(x,y) u = 5*X v = 5*Y plt.figure() plt.rcParams['figure.figsize'] = (12.0,8.0) c = plt.contourf(data, 20, cmap='jet') plt.hold(True) q = plt.quiver(X,Y,u,v,angles='xy',scale=1000,color='r') p = plt.quiverkey(q,1,16.5,50,"50 m/s",coordinates='data',color='r') plt.colorbar() plt.show() and I am getting this error: TypeError: You must first set_array for mappable Can anyone provide guidance on how you overlay quiver plots on top of contours? Please and thanks Felisha Lawrence -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fellow Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer (240)-535-6665 (cell) felisha.lawre...@gmail.com (email) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Error Cannot Import Name Core
Hello, I am trying to install a version of pyart in OSX and I keep getting this error --ImportError Traceback (most recent call last) in ()> 1 import pyart /Users/felishalawrence/anaconda/lib/python2.7/site-packages/pyart/__init__.py in () 9 from .version import version as __version__ 10 #import subpackages---> 11 from . import core 12 from . import io 13 from . import correct ImportError: cannot import name core Any help as to what this means and how to fix it? Thanks, Felisha -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fellow Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer (240)-535-6665 (cell) felisha.lawre...@gmail.com (email) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Renaming Files in Directory
Hello, I have the following program import os path = '/Users/felishalawrence/testswps/vol1' for file in os.listdir(path): newFile = path+file[:file.rindex("v")]+"v20" print newFile and I want to output the results of the 'newFile' variable into the directory specified by the 'path' variable. There are current files in this directory, but I would like tho replace them with different names. Can anyone point me in the right direction? Thanks, Felisha Lawrence -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fellow Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer (240)-535-6665 (cell) felisha.lawre...@gmail.com (email) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Fwd: Fwd: Re: Output 'Strings' to directory
Thanks! Thats exactly what my problem was. I fixed it On Tue, Sep 9, 2014 at 12:57 PM, Alan Gauld wrote: > From: Felisha Lawrence >> Date: Tue, Sep 9, 2014 at 8:53 AM >> Subject: Re: [Tutor] Fwd: Re: Output 'Strings' to directory >> To: Danny Yoo >> >> >> Also, >> I had this code working >> >> import os >> >> path = '/Users/felishalawrence/testswps/vol1' >> for file in os.listdir(path): >> newFile = file[:file.index("v")]+"v20" >> >> print newFile >> and now I am getting this error >> >> ValueError: substring not found >> >> I did not change anything >> > > Have you checked that no new files have been created - possibly by your > code, that don't conform to your expected naming style? > > Try putting a 'print file' before the name modification to see what the > name that causes the error looks like. > > -- > Alan G > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > http://www.flickr.com/photos/alangauldphotos > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fellow Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer (240)-535-6665 (cell) felisha.lawre...@gmail.com (email) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Output 'Strings' to directory
Is it possible to output strings created from a print statement into a directory locally? If so, would you use sysstdout module? Thanks, Felisha -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fellow Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer (240)-535-6665 (cell) felisha.lawre...@gmail.com (email) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] New to Python..Need help
These are all the files. No two filenames are the same swp.1120630020111.KLWX.0.0.5_PPI_v2 swp.1120630020143.KLWX.0.0.9_PPI_v3 swp.1120630020215.KLWX.0.1.3_PPI_v4 swp.1120630020247.KLWX.0.1.8_PPI_v5 swp.1120630020302.KLWX.0.2.4_PPI_v6 swp.1120630020316.KLWX.0.3.1_PPI_v7 swp.1120630020330.KLWX.0.4.0_PPI_v8 swp.1120630020344.KLWX.0.5.1_PPI_v9 swp.1120630020358.KLWX.0.6.4_PPI_v10 swp.1120630020411.KLWX.0.8.0_PPI_v11 swp.1120630020424.KLWX.0.10.0_PPI_v12 swp.1120630020437.KLWX.0.12.5_PPI_v13 swp.1120630020451.KLWX.0.15.6_PPI_v14 swp.1120630020504.KLWX.0.19.5_PPI_v15 On Thu, Sep 4, 2014 at 4:27 PM, Danny Yoo wrote: > On Thu, Sep 4, 2014 at 12:05 PM, taserian wrote: > > Is there anything different between the filenames aside from that suffix > > _vXX? If not, then you'll run into problems after the first filename is > > changed; further attempts won't allow the change, since there's already a > > file with that same name. > > > Ah. Nice catch! Yeah, that's a potential problem with the problem > statement. Felisha, please clarify this point, because it's a big > one. > -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fellow Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer (240)-535-6665 (cell) felisha.lawre...@gmail.com (email) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] New to Python..Need help
Hello, I have a question regarding strings in python. I have a directory on my MacBook Bro of about 13 files. I need to alter the file endings in that directory. The files are on the order of 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. I need to remove the characters after the 'v' and replace with v20. All of the endings of the files are sequential _v2, _v3,_v4, _v5. I need all of these characters to be the same (i.e. v20). I would like to know which modules are best to use, and how to use loops to alter them. Any help you can provide would be great. Thanks, Felisha Lawrence -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fellow Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer (240)-535-6665 (cell) felisha.lawre...@gmail.com (email) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor