You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
1
(5) |
2
(23) |
3
(17) |
4
(14) |
5
(12) |
6
(2) |
7
(3) |
8
(7) |
9
(13) |
10
(19) |
11
(24) |
12
(28) |
13
(9) |
14
(5) |
15
(7) |
16
(17) |
17
(17) |
18
(15) |
19
(6) |
20
|
21
(7) |
22
(20) |
23
(6) |
24
(4) |
25
(5) |
26
(11) |
27
(1) |
28
(2) |
29
(14) |
30
(7) |
|
|
|
|
From: Michiel de H. <mjl...@ya...> - 2010-11-03 07:20:05
|
--- On Tue, 11/2/10, Benjamin Root <ben...@ou...> wrote: I have personally seen significant progress in this area, but there are a few backends that aren't quite right (MacOSX backend, I believe?). As far as I know, show() is working correctly in the MacOSX backend. If you encountered a case where the backend doesn't do the right thing, can you show a concrete example? Best, --Michiel. |
From: Eric F. <ef...@ha...> - 2010-11-03 05:57:47
|
On 11/02/2010 03:18 PM, Jae-Joon Lee wrote: > A quick (and not safe) way w/ mpl v1.0 is, > > ax = plt.subplot(111) > ax.plot(np.arange(3)) > > ax.set_xticks([0, 0.5, 1., 1.5, 2.]) > > mytick = ax.xaxis.majorTicks[2] > mytick._apply_params(tickdir="out") > > I don't think there is a way to do this only using public apis. > I myself actually prefer to create a separate axis (or axes), but this > will be more trickier than above solution. Each tick is a Line2D consisting of a single marker, so it is possible to change the marker after the tick has been created: ax = plt.subplot(1,1,1) ticks = ax.xaxis.get_majorticklines() mytick = ticks[3] mytick.set_marker(2) plt.draw() This will flip the first tick on the top border (the one for 0.2). left, right, up, down are 0, 1, 2, 3. Eric > > Regards, > > -JJ > > > > > On Tue, Nov 2, 2010 at 4:22 AM, Bartosz Telenczuk > <b.t...@bi...> wrote: >> Hi all, >> >> Is it possible to set direction (in or out) individually for each tick. I know about the rc setting ("(x/y)tick.direction") , but I need a finer control over the ticks. >> >> Thanks, >> >> Bartek >> >> ------------------------------------------------------------------------------ >> Nokia and AT&T present the 2010 Calling All Innovators-North America contest >> Create new apps& games for the Nokia N8 for consumers in U.S. and Canada >> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing >> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store >> http://p.sf.net/sfu/nokia-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > ------------------------------------------------------------------------------ > Achieve Improved Network Security with IP and DNS Reputation. > Defend against bad network traffic, including botnets, malware, > phishing sites, and compromised hosts - saving your company time, > money, and embarrassment. Learn More! > http://p.sf.net/sfu/hpdev2dev-nov > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: David F. <dp...@sh...> - 2010-11-03 05:18:30
|
I am trying to use matplotlib (for the first time) to graph the address space usage of an application against time. The data is written to a log file by trace statements throughout the source code of the application. The trace statements contain the current address space usage as well as a timer value with millisecond granularity. My data in the y-axis (address space usage) is fairly uniform (0-2000 MB values), but my data in the x-axis (the time at which the the trace statements were executed) is highly clustered. For example, I have approximately 150 data points over a 5 minute run, but some of the data points are only 10ms apart. I would like to annotate each point on the graph with the line number in the log file so that the user can look up what was happening at that point. I have succeeded, but the graph isn't readable because there is so much overlap in the points. Is there a standard way that people display data like this? I don't really like the idea of equally spacing all of the points along the x-axis because you lose the understanding of the timing. One idea I had was to have some sort of vertical break in the graph at areas where there was a long gap without a data point, but I have no idea whether it's possible to implement something like that in matplotlib. The output format hasn't been strictly specified, so if you have any ideas of how I can produce a useful graph, I would be happy to hear them. Thanks, Dave |
From: Nikolaus R. <Nik...@ra...> - 2010-11-03 03:00:26
|
Hi, Fantastic, path_effect is exactly what I'm looking for. Thanks! -Niko On 11/02/2010 10:16 PM, Jae-Joon Lee wrote: > You may use annotate with which you can specify offsets. > > http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=annotate#matplotlib.pyplot.annotate > > Or, you may consider to use the path_effect (available w/ v1.0). > > http://matplotlib.sourceforge.net/examples/pylab_examples/patheffect_demo.html > > Regards, > > -JJ > > > On Wed, Nov 3, 2010 at 10:44 AM, Nikolaus Rath <Nik...@ra...> wrote: >> Hello, >> >> I am placing a text object in a place where the background is sometimes >> dark and sometimes light, so the text is hard to see. Adding a >> background to the text object itself looks a bit ugly, so I am wondering >> if there is a way to add a shadow to the text itself. >> >> What's the best way to do this? >> >> I thought about redrawing the same text just offset by a fraction of the >> text size, but I can't quite figure out how to do the placement >> properly. My rough idea is the get the position of the text in pixel >> coordinates, add an offset to it and then position it with display >> coordinates as well. But how do I get the display coordinates of >> something that I placed in axes coordinates? And how to I determine how >> many pixels I need to offset without knowing the dpi? >> >> >> Best, >> >> -Nikolaus >> >> -- >> »Time flies like an arrow, fruit flies like a Banana.« >> >> PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C >> >> ------------------------------------------------------------------------------ >> Achieve Improved Network Security with IP and DNS Reputation. >> Defend against bad network traffic, including botnets, malware, >> phishing sites, and compromised hosts - saving your company time, >> money, and embarrassment. Learn More! >> http://p.sf.net/sfu/hpdev2dev-nov >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C |
From: Joe K. <jki...@wi...> - 2010-11-03 02:37:52
|
For whatever it's worth, after a lot of wrangling, I think I solved most of my problems (though perhaps not in the most efficient way). In case anyone else is looking for similar functionality, here's a callback function that will autowrap text objects to the inside of the axis they're plotted in, and should handle any font, rotation, etc that you throw at it. (The previous version had a lot of bugs). Hope someone finds it useful, at any rate... -Joe [image: E2G1j.png] import matplotlib.pyplot as plt def main(): """Draw some very long strings on a figure and have the auto-wrapped to the axis boundaries. Try resizing the figure!!""" fig = plt.figure() plt.axis([0, 10, 0, 10]) t = "This is a really long string that I'd rather have wrapped so"\ " that it doesn't go outside of the figure, but if it's long"\ " enough it will go off the top or bottom!" t2 = r"Furthermore, if I put mathtext in here, it won't mutilate it,"\ " but will treat it like a really long word. For example: "\ r"$\frac{\sigma}{\gamma} - e^{\theta \pm 5}$ won't be mangled!" plt.text(5, 10, t2, size=14, ha='center', va='top', family='monospace') plt.text(3, 0, t, family='serif', style='italic', ha='right') plt.text(4, 1, t, ha='left', family='Times New Roman', rotation=15) plt.text(5, 3.5, t, ha='right', rotation=-15) plt.title("This is a really long title that I want to have wrapped so"\ r" it does not go outside the axis boundaries", ha='center') # All we do to autowrap everything is connect a callback function... fig.canvas.mpl_connect('draw_event', on_draw) plt.show() def on_draw(event): """Auto-wraps all text objects in a figure at draw-time""" import matplotlib as mpl fig = event.canvas.figure # Cycle through all artists in all the axes in the figure for ax in fig.axes: for artist in ax.get_children(): # If it's a text artist, wrap it... if isinstance(artist, mpl.text.Text): autowrap_text(artist, event.renderer) # Temporarily disconnect any callbacks to the draw event... # (To avoid recursion) func_handles = fig.canvas.callbacks.callbacks[event.name] fig.canvas.callbacks.callbacks[event.name] = {} # Re-draw the figure.. fig.canvas.draw() # Reset the draw event callbacks fig.canvas.callbacks.callbacks[event.name] = func_handles def autowrap_text(textobj, renderer): """Wraps the given matplotlib text object so that it doesn't exceed the boundaries of the axis it is plotted in.""" # Get the starting position of the text in pixels... x0, y0 = textobj.get_transform().transform(textobj.get_position()) # Get the extents of the current axis in pixels... clip = textobj.get_axes().get_window_extent() # Set the text to rotate about the left edge (nonsensical otherwise) textobj.set_rotation_mode('anchor') # Get the amount of space in the direction of rotation to the left and # right of x0, y0 (left and right are relative to the rotation) rotation = textobj.get_rotation() right_space = min_dist_inside((x0, y0), rotation, clip) left_space = min_dist_inside((x0, y0), rotation - 180, clip) # Use either the left or right distance depending on the h-alignment. alignment = textobj.get_horizontalalignment() if alignment is 'left': new_width = right_space elif alignment is 'right': new_width = left_space else: new_width = 2 * min(left_space, right_space) # Convert to characters with a minimum width of 1 character wrap_width = max(1, new_width // pixels_per_char(textobj)) try: wrapped_text = safewrap(textobj.get_text(), wrap_width) except TypeError: # This appears to be a single word wrapped_text = textobj.get_text() textobj.set_text(wrapped_text) def min_dist_inside(point, rotation, box): """Gets the space in a given direction from "point" to the boundaries of "box" (where box is an object with x0, y0, x1, & y1 attributes, point is a tuple of x,y, and rotation is the angle in degrees)""" from math import sin, cos, radians x0, y0 = point rotation = radians(rotation) distances = [] threshold = 0.0001 if cos(rotation) > threshold: # Intersects the right axis distances.append((box.x1 - x0) / cos(rotation)) if cos(rotation) < -threshold: # Intersects the left axis distances.append((box.x0 - x0) / cos(rotation)) if sin(rotation) > threshold: # Intersects the top axis distances.append((box.y1 - y0) / sin(rotation)) if sin(rotation) < -threshold: # Intersects the bottom axis distances.append((box.y0 - y0) / sin(rotation)) return min(distances) def pixels_per_char(textobj): """Determines the average width of a character of the given textobj by drawing a test string and calculating it's length""" test_text = 'Try something like a test' orig_text = textobj.get_text() textobj.set_text(test_text) width = textobj.get_window_extent().width textobj.set_text(orig_text) return width / len(test_text) def safewrap(text, width): """Wraps text, but avoids putting linebreaks in tex strings""" import textwrap # If it's not a tex string, just wrap it as usual... if '$' not in text: return textwrap.fill(text, width) # Tex segments will be inside two "$"'s, so we want the odd items segments = text.split('$') tex = segments[1::2] # Temporarily replace spaces and dashes inside tex segments so that # they will be treated as long words by textwrap... segments[1::2] = [x.replace(' ','').replace('-','') for x in tex] # Rejoin the temp tex strings with the rest of the text and wrap it temp_text = '$'.join(segments) wrapped = textwrap.fill(temp_text, width, break_long_words=False) # Put the original tex strings back in between $'s segments = wrapped.split('$') segments[1::2] = tex return '$'.join(segments) if __name__ == '__main__': main() |
From: Jae-Joon L. <lee...@gm...> - 2010-11-03 02:16:27
|
You may use annotate with which you can specify offsets. http://matplotlib.sourceforge.net/api/pyplot_api.html?highlight=annotate#matplotlib.pyplot.annotate Or, you may consider to use the path_effect (available w/ v1.0). http://matplotlib.sourceforge.net/examples/pylab_examples/patheffect_demo.html Regards, -JJ On Wed, Nov 3, 2010 at 10:44 AM, Nikolaus Rath <Nik...@ra...> wrote: > Hello, > > I am placing a text object in a place where the background is sometimes > dark and sometimes light, so the text is hard to see. Adding a > background to the text object itself looks a bit ugly, so I am wondering > if there is a way to add a shadow to the text itself. > > What's the best way to do this? > > I thought about redrawing the same text just offset by a fraction of the > text size, but I can't quite figure out how to do the placement > properly. My rough idea is the get the position of the text in pixel > coordinates, add an offset to it and then position it with display > coordinates as well. But how do I get the display coordinates of > something that I placed in axes coordinates? And how to I determine how > many pixels I need to offset without knowing the dpi? > > > Best, > > -Nikolaus > > -- > »Time flies like an arrow, fruit flies like a Banana.« > > PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C > > ------------------------------------------------------------------------------ > Achieve Improved Network Security with IP and DNS Reputation. > Defend against bad network traffic, including botnets, malware, > phishing sites, and compromised hosts - saving your company time, > money, and embarrassment. Learn More! > http://p.sf.net/sfu/hpdev2dev-nov > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Nikolaus R. <Nik...@ra...> - 2010-11-03 01:45:15
|
Hello, I am placing a text object in a place where the background is sometimes dark and sometimes light, so the text is hard to see. Adding a background to the text object itself looks a bit ugly, so I am wondering if there is a way to add a shadow to the text itself. What's the best way to do this? I thought about redrawing the same text just offset by a fraction of the text size, but I can't quite figure out how to do the placement properly. My rough idea is the get the position of the text in pixel coordinates, add an offset to it and then position it with display coordinates as well. But how do I get the display coordinates of something that I placed in axes coordinates? And how to I determine how many pixels I need to offset without knowing the dpi? Best, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C |
From: Nikolaus R. <Nik...@ra...> - 2010-11-03 01:38:48
|
"Stan West" <sta...@pu...> writes: >> From: Nikolaus Rath [mailto:Nik...@pu...] >> Sent: Saturday, October 30, 2010 16:17 >> >> but if I try to do the same think with the Y axis, everything looks >> messed up (e.g. the matrix is no longer square): > > The matrix remains square for me using a build from Subversion. What's your > matplotlib.__version__? In [16]: matplotlib.__version__ Out[16]: '1.0.0' I attached the result of fig.savefig(). Let's see if it makes it through the list. Best, -Nikolaus -- »Time flies like an arrow, fruit flies like a Banana.« PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6 02CF A9AD B7F8 AE4E 425C |
From: Jae-Joon L. <lee...@gm...> - 2010-11-03 01:18:37
|
A quick (and not safe) way w/ mpl v1.0 is, ax = plt.subplot(111) ax.plot(np.arange(3)) ax.set_xticks([0, 0.5, 1., 1.5, 2.]) mytick = ax.xaxis.majorTicks[2] mytick._apply_params(tickdir="out") I don't think there is a way to do this only using public apis. I myself actually prefer to create a separate axis (or axes), but this will be more trickier than above solution. Regards, -JJ On Tue, Nov 2, 2010 at 4:22 AM, Bartosz Telenczuk <b.t...@bi...> wrote: > Hi all, > > Is it possible to set direction (in or out) individually for each tick. I know about the rc setting ("(x/y)tick.direction") , but I need a finer control over the ticks. > > Thanks, > > Bartek > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: John <was...@gm...> - 2010-11-02 21:48:53
|
I guess sometimes its best to dig into ipython. I apparently misunderstood interp, but it seems it doesn't need to be used only with grids created from a Basemap instance. I created the following function which accomplishes my goals (I know this shouldn't all be in one function, I'll look into making it more 'general' as a next step). If I get around to cleaning it up, I'll repost. --john def create_land_veg_mask(): """ Process to convert Gaussian grid data to lat lon (0.5 deg) for gridded data inside the grib2 ncep files available here: ftp://ftp.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/ """ from mpl_toolkits.basemap import interp, shiftgrid import pygrib def interp_shift(data,lslons,lslats,lonsg,latsg,lons): dataout = interp(data.values,lslons[0,:],lslats[:,0],lonsg,latsg) data_shft,lon_shft = shiftgrid(-180,dataout.T,lons) return lon_shft, lats, data_shft grbs = pygrib.open('gfs.t00z.sfluxgrbf03.grib2') lsmask = grbs.select(name='Land-sea mask')[0] vegtypes = grbs.select(name='Vegetation Type')[0] lslats,lslons = lsmask.latlons() #same for vegtypes reg_lons = np.arange(-360,0,0.5) reg_lats = np.arange(-90,90,0.5) latsg,lonsg = np.meshgrid(reg_lats,reg_lons) lonsout, lats, vegout = interp_shift(vegtypes,lslons,lslats,lonsg,latsg,reg_lons) lonsout, lats, lsmaskout = interp_shift(lsmask,lslons,lslats,lonsg,latsg,lons) return lonsout,lats,vegout,lsmaskout |
From: Eric F. <ef...@ha...> - 2010-11-02 19:59:59
|
On 11/02/2010 04:39 AM, Alan G Isaac wrote: > On 11/2/2010 10:06 AM, Benjamin Root wrote: >> I have personally seen significant progress in this area, but there are a few backends that aren't quite right (MacOSX backend, I believe?). > > > I believe multiple uses of ``show`` fail and are expected to fail > for the foreseeable future when using IDLE to run a script. This may be true in general; the effort has gone, and will continue to go, into getting consistent behavior in ipython and in standalone scripts, not in idle. Nevertheless, the simple test running the attached script with idle on my linux machine (ubuntu 10.10), with mpl from svn, succeeded. This might depend on the default backend, gtkagg in my case. Eric > > fwiw, > Alan Isaac |
From: John <was...@gm...> - 2010-11-02 19:31:30
|
Hello, I have a set of data on a Gaussian grid. I have a latitude array, a longitude array, and a data array: In [121]: vlats.shape Out[121]: (880, 1760) In [122]: vlons.shape Out[122]: (880, 1760) In [123]: vtypes.shape Out[123]: (880, 1760) The longitude seems to go from -360 to 0.6, the latitude is more regular: In [124]: vlons.min(); vlons.max() Out[124]: -360.0 Out[124]: 0.59499999999880615 In [125]: vlats.min(); vlats.max() Out[125]: -89.843513517868473 Out[125]: 89.843513517868473 I thought (and it was also suggested) I could use 'interp' from the mpl_toolkits.basemap package, but I'm not sure how to do this. Does anyone have experience with this? An alternative suggestion was to use the scipy interp capabilities; again, I'm not certain I know how to go about this. Thanks, john |
From: John <was...@gm...> - 2010-11-02 19:02:19
|
I have a file now, that I created from a NCEP grib file. I'm trying to get the land sea mask and the veg types into 0.5x0.5 lat/lon regular grids. However, they are still in Gaussian Grids, but at least I have it assembled into netcdf files! I'll follow up on a post about the conversion. but I would be interested in knowing if what I have done below fits the 'Convention 1.4' definitions: In [64]: vegtype = grbs.select(name='Vegetation Type')[0] In [65]: vlats,vlons = vegtype.latlons() In [67]: vtypes = vegtype.values In [70]: vtypes.shape Out[70]: (880, 1760) In [89]: nco = NetCDFFile('/wrk/jfb/DATASETS_TEMPLATES/JFB_vegtypes.nc','w',format='NETCDF4',zlib=True) In [91]: nco.createDimension('nrows', 880) Out[91]: <netCDF4.Dimension object at 0x8365550> In [92]: nco.createDimension('ncols',1760) Out[92]: <netCDF4.Dimension object at 0x8365b50> In [93]: lat = nco.createVariable('lat','f8',('nrows','ncols'),zlib=True) In [94]: lat[:] = vlats In [95]: lon = nco.createVariable('lon','f8',('nrows','ncols'),zlib=True) In [96]: lon[:] = vlons In [97]: data = nco.createVariable('data','int',('nrows','ncols'),zlib=True) In [98]: data[:] = vtypes In [99]: nco.history="Creating a vegetation types mask from the NCEP ncep.sfluxgrbf03.grb file" In [100]: nco.units="Integer(0-13)" In [101]: nco.close() In [102]: nco = NetCDFFile('/wrk/jfb/DATASETS_TEMPLATES/JFB_vegtypes.nc',format='NETCDF4',zlib=True) In [103]: nco.variables.keys() Out[103]: ['lat', 'lon', 'data'] In [104]: nco.close() I guess officially, I should add something along the lines of: float lat(lat) ; lat:long_name = "latitude" ; lat:units = "degrees_north" ; lat:standard_name = "latitude" ; Thank you, john -- Configuration `````````````````````````` Plone 2.5.3-final, CMF-1.6.4, Zope (Zope 2.9.7-final, python 2.4.4, linux2), Python 2.6 PIL 1.1.6 Mailman 2.1.9 Postfix 2.4.5 Procmail v3.22 2001/09/10 Basemap: 1.0 Matplotlib: 1.0.0 |
From: <dav...@ub...> - 2010-11-02 18:30:27
|
Visit our website at http://www.ubs.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mails are not encrypted and cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. UBS Limited is a company limited by shares incorporated in the United Kingdom registered in England and Wales with number 2035362. Registered office: 1 Finsbury Avenue, London EC2M 2PP. UBS Limited is authorised and regulated by the Financial Services Authority. UBS AG is a public company incorporated with limited liability in Switzerland domiciled in the Canton of Basel-City and the Canton of Zurich respectively registered at the Commercial Registry offices in those Cantons with Identification No: CH-270.3.004.646-4 and having respective head offices at Aeschenvorstadt 1, 4051 Basel and Bahnhofstrasse 45, 8001 Zurich, Switzerland. Registered in the United Kingdom as a foreign company with No: FC021146 and having a UK Establishment registered at Companies House, Cardiff, with No: BR 004507. The principal office of UK Establishment: 1 Finsbury Avenue, London EC2M 2PP. In the United Kingdom, UBS AG is authorised and regulated by the Financial Services Authority. UBS reserves the right to retain all messages. Messages are protected and accessed only in legally justified cases. |
From: Stan W. <sta...@nr...> - 2010-11-02 17:19:53
|
> From: Nikolaus Rath [mailto:Nik...@ra...] > Sent: Saturday, October 30, 2010 16:17 > > but if I try to do the same think with the Y axis, everything looks > messed up (e.g. the matrix is no longer square): The matrix remains square for me using a build from Subversion. What's your matplotlib.__version__? |
From: Stan W. <sta...@nr...> - 2010-11-02 17:09:23
|
From: Gino Serpa [mailto:gin...@gm...] Sent: Sunday, October 31, 2010 13:52 I am trying to change the format of the tick labels in a loglog plot from exponential to decimal. Right now the labels are 10^2 10 1 10^-1 10^-2 and I would like them to be 100 10 1 0.1 0.01 I tried finding easy explanations in the web with no luck. By the way I have no clue what a class is and the word instantiation makes me crossed eyed I hope you don't mind instantiating a class. See the documentation for tick formatters [1], particularly FormatStrFormatter, and the major_minor_demo1 example [2]. [1] http://matplotlib.sourceforge.net/api/ticker_api.html#tick-formatting [2] http://matplotlib.sourceforge.net/examples/pylab_examples/major_minor_demo1.ht ml |
From: Pål G. E. <pa...@gm...> - 2010-11-02 16:13:31
|
Hi Thank you. I installed the latest from svn and it now works. Regards Pål On 2 November 2010 15:21, Benjamin Root <ben...@ou...> wrote: > On Tue, Nov 2, 2010 at 8:20 AM, Pål Gunnar Ellingsen <pa...@gm...>wrote: > >> Hi >> >> I'm trying to use the linthershy option for symlog in >> matplotlib.axes.Axes.set_yscale() <http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_yscale>for >> values smaller than 1, but the plot then shows large values (vertical lines) >> for the points which should have been in the linear range. My code is: >> >> import matplotlib.pyplot as plt >> import numpy as np >> >> >> f1 = np.loadtxt('someDataFile.txt') # file has all y values smaller than 1 >> >> fig1 = plt.figure(1) >> ax1 = fig1.add_subplot(111) >> >> ax1.plot(f1[:, 0], f1[:, 1]) >> >> ax1.set_yscale('symlog', linthreshy = 1e-3) >> ax1.set_ylim(1e-4, 1) >> ax1.autoscale(enable = True, axis = 'x', tight = True) >> >> plt.draw() >> plt.show() >> --------------- >> Another and testable code is >> >> import matplotlib >> matplotlib.use('Qt4Agg') >> import matplotlib.pyplot as plt >> import numpy as np >> >> fig1 = plt.figure(1) >> A = 10 + 9.999999999 * np.sin(2 * np.pi * np.arange(0.01, 1, 0.01)) >> >> ax1 = fig1.add_subplot(111) >> ax1.plot(A) >> >> ax1.set_yscale('symlog', linthreshy = 1e-6) >> ax1.set_ylim(0, 20) # change this to ax1.set_ylim(0, 0.7) for strange >> lines >> >> >> fig2 = plt.figure(2) >> ax2 = fig2.add_subplot(111) >> ax2.plot(A) >> ax2.set_yscale('log') >> ax2.set_ylim(0, 20) >> ax2.autoscale(enable = True, axis = 'both', tight = True) >> >> plt.draw() >> plt.show() >> >> Which does not show correct labels and the linear part is gone (only a >> straight line). >> Does anyone have a solution for these problems? >> >> Regards >> >> Pål >> >> > This was a bug found fairly recently. In the case where the linthresh was > less than 1.0: > > > http://sourceforge.net/tracker/index.php?func=detail&aid=3081451&group_id=80706&atid=560720 > > I don't know if the patch was backported to the maintenance branch, but I > am fairly sure it would have been. > > I hope this was helpful, > Ben Root > > |
From: Alan G I. <ala...@gm...> - 2010-11-02 14:40:14
|
On 11/2/2010 10:06 AM, Benjamin Root wrote: > I have personally seen significant progress in this area, but there are a few backends that aren't quite right (MacOSX backend, I believe?). I believe multiple uses of ``show`` fail and are expected to fail for the foreseeable future when using IDLE to run a script. fwiw, Alan Isaac |
From: Benjamin R. <ben...@ou...> - 2010-11-02 14:22:00
|
On Tue, Nov 2, 2010 at 8:20 AM, Pål Gunnar Ellingsen <pa...@gm...>wrote: > Hi > > I'm trying to use the linthershy option for symlog in > matplotlib.axes.Axes.set_yscale() <http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_yscale>for > values smaller than 1, but the plot then shows large values (vertical lines) > for the points which should have been in the linear range. My code is: > > import matplotlib.pyplot as plt > import numpy as np > > > f1 = np.loadtxt('someDataFile.txt') # file has all y values smaller than 1 > > fig1 = plt.figure(1) > ax1 = fig1.add_subplot(111) > > ax1.plot(f1[:, 0], f1[:, 1]) > > ax1.set_yscale('symlog', linthreshy = 1e-3) > ax1.set_ylim(1e-4, 1) > ax1.autoscale(enable = True, axis = 'x', tight = True) > > plt.draw() > plt.show() > --------------- > Another and testable code is > > import matplotlib > matplotlib.use('Qt4Agg') > import matplotlib.pyplot as plt > import numpy as np > > fig1 = plt.figure(1) > A = 10 + 9.999999999 * np.sin(2 * np.pi * np.arange(0.01, 1, 0.01)) > > ax1 = fig1.add_subplot(111) > ax1.plot(A) > > ax1.set_yscale('symlog', linthreshy = 1e-6) > ax1.set_ylim(0, 20) # change this to ax1.set_ylim(0, 0.7) for strange lines > > > fig2 = plt.figure(2) > ax2 = fig2.add_subplot(111) > ax2.plot(A) > ax2.set_yscale('log') > ax2.set_ylim(0, 20) > ax2.autoscale(enable = True, axis = 'both', tight = True) > > plt.draw() > plt.show() > > Which does not show correct labels and the linear part is gone (only a > straight line). > Does anyone have a solution for these problems? > > Regards > > Pål > > This was a bug found fairly recently. In the case where the linthresh was less than 1.0: http://sourceforge.net/tracker/index.php?func=detail&aid=3081451&group_id=80706&atid=560720 I don't know if the patch was backported to the maintenance branch, but I am fairly sure it would have been. I hope this was helpful, Ben Root |
From: Benjamin R. <ben...@ou...> - 2010-11-02 14:16:28
|
On Tue, Nov 2, 2010 at 9:00 AM, John <was...@gm...> wrote: > Thanks Ben! > > I guess where I am with this now is that I have found, as you say, the > VGTYP in the > operational products (the *sflux* grib files), but I don't find it on > any of the 0.5 x 0.5 degree files. Which means, that as you say, I'll > have to figure out how to reproject the data from the Gaussian grid to > a regular grid with 0.5x0.5 lat lon coordinates. > > Any thoughts on that process?? :D > > Thanks again, > john > > > I haven't tried doing conversions between two different projections, but maybe the Basemap package might be useful? http://matplotlib.sourceforge.net/basemap/doc/html/ Basically, you could get the arrays of x and y positions of your data, and then determine what would be the x and y positions of the projection that you want, and then use scipy's griddata to produce the results on the grid you want: http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.griddata.html#scipy.interpolate.griddata This is a bit brute-force, and I am sure there are more elegant solutions, but that should work in a pinch. Ben Root |
From: Benjamin R. <ben...@ou...> - 2010-11-02 14:06:51
|
On Tue, Nov 2, 2010 at 8:31 AM, Daπid <dav...@gm...> wrote: > On Tue, Nov 2, 2010 at 12:49 PM, David Kremer <dav...@gm...> > wrote: > > Personally I used show() yesterday, and it blocks the execution until > > the figure's window is closed. It is of perfect convenience I think, > > as a default behavior. > > Yes, this is the optimal behavior, but it is not fully implemented, as > seen in the documentation. > > I have personally seen significant progress in this area, but there are a few backends that aren't quite right (MacOSX backend, I believe?). Anyway, some effort was made right before the 1.0.0 release, but it was soon discovered that it was still not right (and even caused some regressions, I believe). So, shortly there-after, a lot of work went into making the behavior more uniform across all backends. If the show() behavior is currently not working properly for you, I would suggest building from source (if possible) the maintenance v1.0.0 branch which has it mostly right (I believe the only exception is the macosx backend). If that isn't possible, there have been talks of soon releasing a v1.0.1 package which would contain all of those fixes. Note, I am not an authority in this matter as I was only just joining the development group at around that time, but I hope this answers your question. Ben Root |
From: John <was...@gm...> - 2010-11-02 14:00:38
|
Thanks Ben! I guess where I am with this now is that I have found, as you say, the VGTYP in the operational products (the *sflux* grib files), but I don't find it on any of the 0.5 x 0.5 degree files. Which means, that as you say, I'll have to figure out how to reproject the data from the Gaussian grid to a regular grid with 0.5x0.5 lat lon coordinates. Any thoughts on that process?? :D Thanks again, john > > John, > > GRIB files are an interesting beast. It has been awhile since I have dealt > with them, but I will try to help you with what I can recall. First, the > data records in the files are indicated by: > > 1. Record number > 2. Position in bytes > 3. Date (YYMMDDHH). > 4. Parameter name (LAND=land/sea mask) > 5. Indicator of parameter and units (grib PDS octet 9) > 6. Type of level/layer (grib PDS octet 10) > > > 7. Height, pressure, etc (grib PDS octets 11-12) > 8. Time Range (grib PDS octet 21) > 9. Period of time 1, (grib PDS octet 19) > 10. Period of time 2, (grib PDS octet 20) > 11. Forecast time unit (grib PDS octet 18) > > > 12. level > 13. anl=analysis, fcst=forecast > 14. NAve (number of grids used to make average) > > The "type of level/layer" I believe is the grid projection type. Anyway, > these things can be mixed and matched, so all we need to do is find your > parameter in the grid projection that you want (or you will have to > re-project the data). > > The operational models appear to have VGTYP, but the reanalysis products do > not appear to have this. Maybe this is causing your confusion? > > This page might be more useful to you: > http://www.cpc.noaa.gov/products/wesley/wgrib.html > > I hope this is useful, > Ben Root > > -- Configuration `````````````````````````` Plone 2.5.3-final, CMF-1.6.4, Zope (Zope 2.9.7-final, python 2.4.4, linux2), Python 2.6 PIL 1.1.6 Mailman 2.1.9 Postfix 2.4.5 Procmail v3.22 2001/09/10 Basemap: 1.0 Matplotlib: 1.0.0 |
From: Benjamin R. <ben...@ou...> - 2010-11-02 13:54:51
|
On Tue, Nov 2, 2010 at 5:19 AM, John <was...@gm...> wrote: > Maybe I should also follow up on this and indicate that one variable I > really want is the Veg Type defiinitions from the files. It exists in > the file from joewheatley's example, (VGTYP_P0_L1_GGA0) but it is on a > Gaussian lat/lon grid. I've downloaded some of the gfs files from the > 0.5 x 0.5 degree output, but I don't find the variable. > > Thanks again! > > On Tue, Nov 2, 2010 at 10:33 AM, John <was...@gm...> wrote: > > Folks, > > > > I'm trying to find documentation online that provides guidance on what > > all the variables are that are in the NCEP model output grib files. > > There are many NCEP models, so to be clear, I'm referring to the GFS > > 0.5x0.5 degree product. I was looking at this nice blog: > > > > http://joewheatley.net/ncep-global-forecast-system/ > > > > and the files that are available here: > > ftp://ftp.ncep.noaa.gov/pub/data/nccf/com/gfs/prod > > > > And I see this link: > > http://www.nco.ncep.noaa.gov/pmb/products/gfs/ > > > > But looking at a file and the variables: > > In [112]: ncep.variables.keys() > > Out[112]: > > ['PRES_P8_L223_GLL0_avg', > > 'TOZNE_P0_L200_GLL0', > > 'PRES_P0_L242_GLL0', > > 'HGT_P0_L100_GLL0', > > 'VVEL_P0_L100_GLL0', > > 'UGRD_P0_L6_GLL0', > > 'HGT_P0_L7_GLL0', > > 'CIN_P0_2L108_GLL0', > > 'ULWRF_P8_L8_GLL0_avg', > > 'PRES_P0_L109_GLL0', > > (snip) > > > > is somewhat clear in most cases, but is there a table which directly > > maps these online?. Also, you can of course look at the 'long_name', > > 'level', and 'level_type' attributes of each variable, but I'm looking > > more or less for an online table showing all this. Maybe I need to > > script it quickly ;) > > > > Thanks, > > john > > > > John, GRIB files are an interesting beast. It has been awhile since I have dealt with them, but I will try to help you with what I can recall. First, the data records in the files are indicated by: 1. Record number 2. Position in bytes 3. Date (YYMMDDHH). 4. Parameter name (LAND=land/sea mask) 5. Indicator of parameter and units (grib PDS octet 9) 6. Type of level/layer (grib PDS octet 10) 7. Height, pressure, etc (grib PDS octets 11-12) 8. Time Range (grib PDS octet 21) 9. Period of time 1, (grib PDS octet 19) 10. Period of time 2, (grib PDS octet 20) 11. Forecast time unit (grib PDS octet 18) 12. level 13. anl=analysis, fcst=forecast 14. NAve (number of grids used to make average) The "type of level/layer" I believe is the grid projection type. Anyway, these things can be mixed and matched, so all we need to do is find your parameter in the grid projection that you want (or you will have to re-project the data). The operational models appear to have VGTYP, but the reanalysis products do not appear to have this. Maybe this is causing your confusion? This page might be more useful to you: http://www.cpc.noaa.gov/products/wesley/wgrib.html I hope this is useful, Ben Root |
From: Daπid <dav...@gm...> - 2010-11-02 13:32:06
|
On Tue, Nov 2, 2010 at 12:49 PM, David Kremer <dav...@gm...> wrote: > Personally I used show() yesterday, and it blocks the execution until > the figure's window is closed. It is of perfect convenience I think, > as a default behavior. Yes, this is the optimal behavior, but it is not fully implemented, as seen in the documentation. |
From: Pål G. E. <pa...@gm...> - 2010-11-02 13:20:31
|
Hi I'm trying to use the linthershy option for symlog in matplotlib.axes.Axes.set_yscale() <http://matplotlib.sourceforge.net/api/axes_api.html#matplotlib.axes.Axes.set_yscale>for values smaller than 1, but the plot then shows large values (vertical lines) for the points which should have been in the linear range. My code is: import matplotlib.pyplot as plt import numpy as np f1 = np.loadtxt('someDataFile.txt') # file has all y values smaller than 1 fig1 = plt.figure(1) ax1 = fig1.add_subplot(111) ax1.plot(f1[:, 0], f1[:, 1]) ax1.set_yscale('symlog', linthreshy = 1e-3) ax1.set_ylim(1e-4, 1) ax1.autoscale(enable = True, axis = 'x', tight = True) plt.draw() plt.show() --------------- Another and testable code is import matplotlib matplotlib.use('Qt4Agg') import matplotlib.pyplot as plt import numpy as np fig1 = plt.figure(1) A = 10 + 9.999999999 * np.sin(2 * np.pi * np.arange(0.01, 1, 0.01)) ax1 = fig1.add_subplot(111) ax1.plot(A) ax1.set_yscale('symlog', linthreshy = 1e-6) ax1.set_ylim(0, 20) # change this to ax1.set_ylim(0, 0.7) for strange lines fig2 = plt.figure(2) ax2 = fig2.add_subplot(111) ax2.plot(A) ax2.set_yscale('log') ax2.set_ylim(0, 20) ax2.autoscale(enable = True, axis = 'both', tight = True) plt.draw() plt.show() Which does not show correct labels and the linear part is gone (only a straight line). Does anyone have a solution for these problems? Regards Pål |