SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S






1
(4)
2
3
(8)
4
(16)
5
(40)
6
(16)
7
(9)
8
(15)
9
(6)
10
(4)
11
(28)
12
(6)
13
(2)
14
(7)
15
(8)
16
17
18
(9)
19
(2)
20
(7)
21
(3)
22
(6)
23
(25)
24
(16)
25
(8)
26
(7)
27
(3)
28
(1)
29
(4)
30
(21)
31
(15)





Showing 7 results of 7

Revision: 7577
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7577&view=rev
Author: jswhit
Date: 2009年08月26日 17:01:34 +0000 (2009年8月26日)
Log Message:
-----------
nightime regions were calculated incorrectly when solar declination < 0
(NH winter).
Modified Paths:
--------------
 trunk/toolkits/basemap/lib/mpl_toolkits/basemap/solar.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/solar.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/solar.py	2009年08月26日 15:32:59 UTC (rev 7576)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/solar.py	2009年08月26日 17:01:34 UTC (rev 7577)
@@ -48,19 +48,22 @@
 # compute day/night terminator from hour angle, declination.
 longitude = lons + tau
 lats = np.arctan(-np.cos(longitude*dg2rad)/np.tan(dec*dg2rad))/dg2rad
- return lons, lats
+ return lons, lats, tau, dec
 
 def daynight_grid(date, delta, lonmin, lonmax):
 """
 date is datetime object (assumed UTC).
 delta is the grid interval (in degrees) used to compute terminator."""
- lons, lats = daynight_terminator(date, delta, lonmin, lonmax)
+ lons, lats, tau, dec = daynight_terminator(date, delta, lonmin, lonmax)
 # create day/night grid (1 for night, 0 for day)
 lats2 = np.arange(-90,90+0.5*delta,delta,dtype=np.float32)
 nlons = len(lons); nlats = len(lats2)
 lons2, lats2 = np.meshgrid(lons,lats2)
 lats = lats[np.newaxis,:]*np.ones((nlats,nlons),dtype=np.float32)
 daynight = np.ones(lons2.shape, np.int8)
- daynight = np.where(lats2>lats,0,daynight)
+ if dec > 0: # NH summer
+ daynight = np.where(lats2>lats,0,daynight)
+ else: # NH winter
+ daynight = np.where(lats2<lats,0,daynight)
 daynight = ma.array(daynight,mask=1-daynight) # mask day areas.
 return lons2,lats2,daynight
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <js...@us...> - 2009年08月26日 15:33:06
Revision: 7576
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7576&view=rev
Author: jswhit
Date: 2009年08月26日 15:32:59 +0000 (2009年8月26日)
Log Message:
-----------
added mention of new example.
Modified Paths:
--------------
 trunk/toolkits/basemap/Changelog
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog	2009年08月26日 15:29:57 UTC (rev 7575)
+++ trunk/toolkits/basemap/Changelog	2009年08月26日 15:32:59 UTC (rev 7576)
@@ -1,5 +1,6 @@
 version 0.99.5 (not yet released)
 * added 'nightshade' method to shade night regions on a map.
+ 'daynight.py' example added to illustrate usage.
 * added lonmin, lonmax instance variables.
 version 0.99.4 (svn revision 7332)
 * ax.frame replaced with ax.spines to maintain compatibility 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <js...@us...> - 2009年08月26日 15:30:03
Revision: 7575
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7575&view=rev
Author: jswhit
Date: 2009年08月26日 15:29:57 +0000 (2009年8月26日)
Log Message:
-----------
format date in title
Modified Paths:
--------------
 trunk/toolkits/basemap/examples/daynight.py
Modified: trunk/toolkits/basemap/examples/daynight.py
===================================================================
--- trunk/toolkits/basemap/examples/daynight.py	2009年08月26日 11:52:06 UTC (rev 7574)
+++ trunk/toolkits/basemap/examples/daynight.py	2009年08月26日 15:29:57 UTC (rev 7575)
@@ -19,5 +19,5 @@
 # map shows through. Use current time in UTC.
 date = datetime.utcnow()
 CS=map.nightshade(date)
-plt.title('Day/Night Map for %s (UTC)' % date)
+plt.title('Day/Night Map for %s (UTC)' % date.strftime("%d %b %Y %H:%M:%S"))
 plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7574
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7574&view=rev
Author: jswhit
Date: 2009年08月26日 11:52:06 +0000 (2009年8月26日)
Log Message:
-----------
check that date is utc in nightshade
Modified Paths:
--------------
 trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py	2009年08月26日 11:33:41 UTC (rev 7573)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py	2009年08月26日 11:52:06 UTC (rev 7574)
@@ -3445,6 +3445,9 @@
 returns a matplotlib.contour.ContourSet instance.
 """
 from solar import daynight_grid
+ # make sure date is utc.
+ if date.utcoffset() is not None:
+ raise ValueError('datetime instance must be UTC')
 # create grid of day=0, night=1
 lons,lats,daynight = daynight_grid(date,delta,self.lonmin,self.lonmax)
 x,y = self(lons,lats)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <js...@us...> - 2009年08月26日 11:33:47
Revision: 7573
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7573&view=rev
Author: jswhit
Date: 2009年08月26日 11:33:41 +0000 (2009年8月26日)
Log Message:
-----------
up version number
Modified Paths:
--------------
 trunk/toolkits/basemap/doc/conf.py
Modified: trunk/toolkits/basemap/doc/conf.py
===================================================================
--- trunk/toolkits/basemap/doc/conf.py	2009年08月26日 11:32:41 UTC (rev 7572)
+++ trunk/toolkits/basemap/doc/conf.py	2009年08月26日 11:33:41 UTC (rev 7573)
@@ -46,9 +46,9 @@
 # other places throughout the built documents.
 #
 # The short X.Y version.
-version = '0.99.4'
+version = '0.99.5'
 # The full version, including alpha/beta/rc tags.
-release = '0.99.4'
+release = '0.99.5'
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <js...@us...> - 2009年08月26日 11:32:48
Revision: 7572
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7572&view=rev
Author: jswhit
Date: 2009年08月26日 11:32:41 +0000 (2009年8月26日)
Log Message:
-----------
cosmetic cleanup.
Modified Paths:
--------------
 trunk/toolkits/basemap/examples/daynight.py
Modified: trunk/toolkits/basemap/examples/daynight.py
===================================================================
--- trunk/toolkits/basemap/examples/daynight.py	2009年08月26日 01:12:32 UTC (rev 7571)
+++ trunk/toolkits/basemap/examples/daynight.py	2009年08月26日 11:32:41 UTC (rev 7572)
@@ -5,6 +5,7 @@
 
 # example showing how to compute the day/night terminator and shade nightime
 # areas on a map.
+
 # miller projection 
 map = Basemap(projection='mill',lon_0=180)
 # plot coastlines, draw label meridians and parallels.
@@ -14,9 +15,8 @@
 # fill continents 'coral' (with zorder=0), color wet areas 'aqua'
 map.drawmapboundary(fill_color='aqua')
 map.fillcontinents(color='coral',lake_color='aqua')
-# shade the night areas gray, with alpha transparency so the 
-# map shows through.
-# use current time in UTC.
+# shade the night areas, with alpha transparency so the 
+# map shows through. Use current time in UTC.
 date = datetime.utcnow()
 CS=map.nightshade(date)
 plt.title('Day/Night Map for %s (UTC)' % date)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <js...@us...> - 2009年08月26日 01:12:49
Revision: 7571
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7571&view=rev
Author: jswhit
Date: 2009年08月26日 01:12:32 +0000 (2009年8月26日)
Log Message:
-----------
added nightshade method
Modified Paths:
--------------
 trunk/toolkits/basemap/Changelog
 trunk/toolkits/basemap/examples/daynight.py
 trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
 trunk/toolkits/basemap/setup.py
Added Paths:
-----------
 trunk/toolkits/basemap/lib/mpl_toolkits/basemap/solar.py
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog	2009年08月25日 20:06:13 UTC (rev 7570)
+++ trunk/toolkits/basemap/Changelog	2009年08月26日 01:12:32 UTC (rev 7571)
@@ -1,3 +1,6 @@
+version 0.99.5 (not yet released)
+ * added 'nightshade' method to shade night regions on a map.
+ * added lonmin, lonmax instance variables.
 version 0.99.4 (svn revision 7332)
 * ax.frame replaced with ax.spines to maintain compatibility 
 with matplotlib spines support.
Modified: trunk/toolkits/basemap/examples/daynight.py
===================================================================
--- trunk/toolkits/basemap/examples/daynight.py	2009年08月25日 20:06:13 UTC (rev 7570)
+++ trunk/toolkits/basemap/examples/daynight.py	2009年08月26日 01:12:32 UTC (rev 7571)
@@ -1,93 +1,16 @@
 import numpy as np
-from mpl_toolkits.basemap import Basemap, netcdftime
+from mpl_toolkits.basemap import Basemap
 import matplotlib.pyplot as plt
 from datetime import datetime
-from numpy import ma
 
 # example showing how to compute the day/night terminator and shade nightime
 # areas on a map.
-
-def epem(date):
- """
- input: date - datetime object (assumed UTC)
- ouput: gha - Greenwich hour angle, the angle between the Greenwich
- meridian and the meridian containing the subsolar point.
- dec - solar declination.
- """
- dg2rad = np.pi/180.
- rad2dg = 1./dg2rad
- # compute julian day from UTC datetime object.
- jday = netcdftime.JulianDayFromDate(date)
- jd = np.floor(jday) # truncate to integer.
- # utc hour.
- ut = date.hour + date.minute/60. + date.second/3600.
- # calculate number of centuries from J2000
- t = (jd + (ut/24.) - 2451545.0) / 36525.
- # mean longitude corrected for aberration
- l = (280.460 + 36000.770 * t) % 360
- # mean anomaly
- g = 357.528 + 35999.050 * t
- # ecliptic longitude
- lm = l + 1.915 * np.sin(g*dg2rad) + 0.020 * np.sin(2*g*dg2rad)
- # obliquity of the ecliptic
- ep = 23.4393 - 0.01300 * t
- # equation of time
- eqtime = -1.915*np.sin(g*dg2rad) - 0.020*np.sin(2*g*dg2rad) \
- + 2.466*np.sin(2*lm*dg2rad) - 0.053*np.sin(4*lm*dg2rad)
- # Greenwich hour angle
- gha = 15*ut - 180 + eqtime
- # declination of sun
- dec = np.arcsin(np.sin(ep*dg2rad) * np.sin(lm*dg2rad)) * rad2dg
- return gha, dec
-
-def daynightgrid(date, nlons):
- """
- date is datetime object (assumed UTC).
- nlons is # of longitudes used to compute terminator."""
- dg2rad = np.pi/180.
- lons = np.linspace(-180,180,nlons).astype(np.float32)
- # compute greenwich hour angle and solar declination
- # from datetime object (assumed UTC).
- tau, dec = epem(date) 
- # compute day/night terminator from hour angle, declination.
- longitude = lons + tau
- lats = np.arctan(-np.cos(longitude*dg2rad)/np.tan(dec*dg2rad))/dg2rad
- # create day/night grid (1 for night, 0 for day)
- nlats = ((nlons-1)/2)+1
- lons2 = np.linspace(-180,180,nlons).astype(np.float32)
- lats2 = np.linspace(-90,90,nlats).astype(np.float32)
- lons2, lats2 = np.meshgrid(lons2,lats2)
- lats = lats[np.newaxis,:]*np.ones((nlats,nlons),dtype=np.float32)
- daynight = np.ones(lons2.shape, np.int8)
- daynight = np.where(lats2>lats,0,daynight)
- daynight = ma.array(daynight,mask=1-daynight) # mask day areas.
- return lons2,lats2,daynight
-
-class Basemap2(Basemap):
- def nightshade(self,date,color="k",nlons=1441,alpha=0.5,zorder=None):
- # create grid of day=0, night=1
- # 1441 means use a 0.25 degree grid.
- lons,lats,daynight = daynightgrid(date,nlons)
- x,y = self(lons,lats)
- # contour the day-night grid, coloring the night area
- # with the specified color and transparency.
- CS = map.contourf(x,y,daynight,1,colors=[color],alpha=alpha)
- # set zorder on ContourSet collections show night shading
- # is on top.
- for c in CS.collections:
- if zorder is None:
- c.set_zorder(c.get_zorder()+1)
- else:
- c.set_zorder(zorder)
- return CS
-
-
 # miller projection 
-map = Basemap2(projection='mill',lon_0=0)
+map = Basemap(projection='mill',lon_0=180)
 # plot coastlines, draw label meridians and parallels.
 map.drawcoastlines()
 map.drawparallels(np.arange(-90,90,30),labels=[1,0,0,0])
-map.drawmeridians(np.arange(-180,180,60),labels=[0,0,0,1])
+map.drawmeridians(np.arange(map.lonmin,map.lonmax+30,60),labels=[0,0,0,1])
 # fill continents 'coral' (with zorder=0), color wet areas 'aqua'
 map.drawmapboundary(fill_color='aqua')
 map.fillcontinents(color='coral',lake_color='aqua')
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py	2009年08月25日 20:06:13 UTC (rev 7570)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py	2009年08月26日 01:12:32 UTC (rev 7571)
@@ -53,7 +53,7 @@
 else:
 basemap_datadir = os.sep.join([os.path.dirname(__file__), 'data'])
 
-__version__ = '0.99.4'
+__version__ = '0.99.5'
 
 # supported map projections.
 _projnames = {'cyl' : 'Cylindrical Equidistant',
@@ -3421,6 +3421,42 @@
 raise KeyError("barstyle must be 'simple' or 'fancy'")
 return rets
 
+ def nightshade(self,date,color="k",delta=0.25,alpha=0.5,ax=None,zorder=2):
+ """
+ Shade the regions of the map that are in darkness at the time
+ specifed by ``date``. ``date`` is a datetime instance,
+ assumed to be UTC.
+
+ .. tabularcolumns:: |l|L|
+
+ ============== ====================================================
+ Keywords Description
+ ============== ====================================================
+ color color to shade night regions (default black).
+ delta day/night terminator is computed with a
+ a resolution of ``delta`` degrees (default 0.25).
+ alpha alpha transparency for shading (default 0.5, so
+ map background shows through).
+ zorder zorder for shading (default 2).
+ ============== ====================================================
+
+ Extra keyword ``ax`` can be used to override the default axis instance.
+
+ returns a matplotlib.contour.ContourSet instance.
+ """
+ from solar import daynight_grid
+ # create grid of day=0, night=1
+ lons,lats,daynight = daynight_grid(date,delta,self.lonmin,self.lonmax)
+ x,y = self(lons,lats)
+ # contour the day-night grid, coloring the night area
+ # with the specified color and transparency.
+ CS = self.contourf(x,y,daynight,1,colors=[color],alpha=alpha,ax=ax)
+ # set zorder on ContourSet collections show night shading
+ # is on top.
+ for c in CS.collections:
+ c.set_zorder(zorder)
+ return CS
+
 def _check_ax(self):
 """
 Returns the axis on which to draw.
Added: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/solar.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/solar.py	 (rev 0)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/solar.py	2009年08月26日 01:12:32 UTC (rev 7571)
@@ -0,0 +1,66 @@
+# some simple functions to calculate solar position, day-night terminator
+import numpy as np
+from numpy import ma
+import netcdftime
+
+def epem(date):
+ """
+ input: date - datetime object (assumed UTC)
+ ouput: gha - Greenwich hour angle, the angle between the Greenwich
+ meridian and the meridian containing the subsolar point.
+ dec - solar declination.
+ """
+ dg2rad = np.pi/180.
+ rad2dg = 1./dg2rad
+ # compute julian day from UTC datetime object.
+ jday = netcdftime.JulianDayFromDate(date)
+ jd = np.floor(jday) # truncate to integer.
+ # utc hour.
+ ut = date.hour + date.minute/60. + date.second/3600.
+ # calculate number of centuries from J2000
+ t = (jd + (ut/24.) - 2451545.0) / 36525.
+ # mean longitude corrected for aberration
+ l = (280.460 + 36000.770 * t) % 360
+ # mean anomaly
+ g = 357.528 + 35999.050 * t
+ # ecliptic longitude
+ lm = l + 1.915 * np.sin(g*dg2rad) + 0.020 * np.sin(2*g*dg2rad)
+ # obliquity of the ecliptic
+ ep = 23.4393 - 0.01300 * t
+ # equation of time
+ eqtime = -1.915*np.sin(g*dg2rad) - 0.020*np.sin(2*g*dg2rad) \
+ + 2.466*np.sin(2*lm*dg2rad) - 0.053*np.sin(4*lm*dg2rad)
+ # Greenwich hour angle
+ gha = 15*ut - 180 + eqtime
+ # declination of sun
+ dec = np.arcsin(np.sin(ep*dg2rad) * np.sin(lm*dg2rad)) * rad2dg
+ return gha, dec
+
+def daynight_terminator(date, delta, lonmin, lonmax):
+ """
+ date is datetime object (assumed UTC).
+ nlons is # of longitudes used to compute terminator."""
+ dg2rad = np.pi/180.
+ lons = np.arange(lonmin,lonmax+0.5*delta,delta,dtype=np.float32)
+ # compute greenwich hour angle and solar declination
+ # from datetime object (assumed UTC).
+ tau, dec = epem(date) 
+ # compute day/night terminator from hour angle, declination.
+ longitude = lons + tau
+ lats = np.arctan(-np.cos(longitude*dg2rad)/np.tan(dec*dg2rad))/dg2rad
+ return lons, lats
+
+def daynight_grid(date, delta, lonmin, lonmax):
+ """
+ date is datetime object (assumed UTC).
+ delta is the grid interval (in degrees) used to compute terminator."""
+ lons, lats = daynight_terminator(date, delta, lonmin, lonmax)
+ # create day/night grid (1 for night, 0 for day)
+ lats2 = np.arange(-90,90+0.5*delta,delta,dtype=np.float32)
+ nlons = len(lons); nlats = len(lats2)
+ lons2, lats2 = np.meshgrid(lons,lats2)
+ lats = lats[np.newaxis,:]*np.ones((nlats,nlons),dtype=np.float32)
+ daynight = np.ones(lons2.shape, np.int8)
+ daynight = np.where(lats2>lats,0,daynight)
+ daynight = ma.array(daynight,mask=1-daynight) # mask day areas.
+ return lons2,lats2,daynight
Modified: trunk/toolkits/basemap/setup.py
===================================================================
--- trunk/toolkits/basemap/setup.py	2009年08月25日 20:06:13 UTC (rev 7570)
+++ trunk/toolkits/basemap/setup.py	2009年08月26日 01:12:32 UTC (rev 7571)
@@ -225,7 +225,7 @@
 package_data = {'mpl_toolkits.basemap':pyproj_datafiles+basemap_datafiles}
 setup(
 name = "basemap",
- version = "0.99.4",
+ version = "0.99.5",
 description = "Plot data on map projections with matplotlib",
 long_description = """
 An add-on toolkit for matplotlib that lets you plot data
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing 7 results of 7

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /