SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <js...@us...> - 2007年09月22日 17:27:55
Revision: 3876
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3876&view=rev
Author: jswhit
Date: 2007年09月22日 10:27:53 -0700 (2007年9月22日)
Log Message:
-----------
updated URL
Modified Paths:
--------------
 trunk/toolkits/basemap/examples/fcstmaps.py
Modified: trunk/toolkits/basemap/examples/fcstmaps.py
===================================================================
--- trunk/toolkits/basemap/examples/fcstmaps.py	2007年09月22日 15:10:00 UTC (rev 3875)
+++ trunk/toolkits/basemap/examples/fcstmaps.py	2007年09月22日 17:27:53 UTC (rev 3876)
@@ -50,7 +50,7 @@
 # set OpenDAP server URL.
 HH='09'
 URLbase="http://nomad3.ncep.noaa.gov:9090/dods/sref/sref"
-URL=URLbase+YYYYMMDD+"/sref_eta1_"+HH+"z.ctl"
+URL=URLbase+YYYYMMDD+"/sref_eta_ctl1_"+HH+"z"
 print URL+'\n'
 try:
 data = client.open(URL)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <js...@us...> - 2007年11月26日 19:14:42
Revision: 4455
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4455&view=rev
Author: jswhit
Date: 2007年11月26日 11:14:29 -0800 (2007年11月26日)
Log Message:
-----------
adjust map projection region
Modified Paths:
--------------
 trunk/toolkits/basemap/examples/fcstmaps.py
Modified: trunk/toolkits/basemap/examples/fcstmaps.py
===================================================================
--- trunk/toolkits/basemap/examples/fcstmaps.py	2007年11月26日 19:08:46 UTC (rev 4454)
+++ trunk/toolkits/basemap/examples/fcstmaps.py	2007年11月26日 19:14:29 UTC (rev 4455)
@@ -84,9 +84,7 @@
 t2min = t2mvar[0:ntimes,:,:]
 t2m = numpy.zeros((ntimes,nlats,nlons+1),t2min.dtype)
 # create Basemap instance for Orthographic projection.
-m = Basemap(lon_0=-105,lat_0=40,
- rsphere=6371200.,
- resolution='c',area_thresh=5000.,projection='ortho')
+m = Basemap(lon_0=-90,lat_0=60,projection='ortho')
 # add wrap-around point in longitude.
 for nt in range(ntimes):
 t2m[nt,:,:], lons = addcyclic(t2min[nt,:,:], lons1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <js...@us...> - 2007年12月04日 18:48:07
Revision: 4582
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4582&view=rev
Author: jswhit
Date: 2007年12月04日 10:48:02 -0800 (2007年12月04日)
Log Message:
-----------
use num2date
Modified Paths:
--------------
 trunk/toolkits/basemap/examples/fcstmaps.py
Modified: trunk/toolkits/basemap/examples/fcstmaps.py
===================================================================
--- trunk/toolkits/basemap/examples/fcstmaps.py	2007年12月04日 18:37:40 UTC (rev 4581)
+++ trunk/toolkits/basemap/examples/fcstmaps.py	2007年12月04日 18:48:02 UTC (rev 4582)
@@ -6,35 +6,9 @@
 import sys
 from numpy import ma
 import datetime
-from matplotlib.toolkits.basemap import Basemap, NetCDFFile, addcyclic
+from matplotlib.toolkits.basemap import Basemap, NetCDFFile, addcyclic, num2date
 
 
-hrsgregstart = 13865688 # hrs from 00010101 to 15821015 in Julian calendar.
-# times in many datasets use mixed Gregorian/Julian calendar, datetime 
-# module uses a proleptic Gregorian calendar. So, I use datetime to compute
-# hours since start of Greg. calendar (15821015) and add this constant to
-# get hours since 1-Jan-0001 in the mixed Gregorian/Julian calendar.
-gregstart = datetime.datetime(1582,10,15) # datetime.datetime instance
-
-def dateto_hrs_since_day1CE(curdate):
- """given datetime.datetime instance, compute hours since 1-Jan-0001"""
- if curdate < gregstart:
- msg = 'date must be after start of gregorian calendar (15821015)!'
- raise ValueError, msg
- difftime = curdate-gregstart
- hrsdiff = 24*difftime.days + difftime.seconds/3600
- return hrsdiff+hrsgregstart
-
-def hrs_since_day1CE_todate(hrs):
- """return datetime.datetime instance given hours since 1-Jan-0001"""
- if hrs < 0.0:
- msg = "hrs must be positive!"
- raise ValueError, msg
- delta = datetime.timedelta(hours=1)
- hrs_sincegreg = hrs - hrsgregstart
- curdate = gregstart + hrs_sincegreg*delta
- return curdate
-
 # today's date is default.
 if len(sys.argv) > 1:
 YYYYMMDD = sys.argv[1]
@@ -62,14 +36,17 @@
 longitudes = data.variables['lon']
 fcsttimes = data.variables['time']
 times = fcsttimes[0:6] # first 6 forecast times.
+# change 0.0 to 00 at end of time units string
+# (so strptime will understand it).
+timeunits = fcsttimes.units[:-2]+'0'
 ntimes = len(times)
 # put forecast times in YYYYMMDDHH format.
 verifdates = []
 fcsthrs=[]
-print times
 for time in times:
+ print time, times[0]
 fcsthrs.append(int((time-times[0])*24))
- fdate = hrs_since_day1CE_todate(int(time*24.0)) 
+ fdate = num2date(time,'days since 0001年01月01日 00:00:00')
 verifdates.append(fdate.strftime('%Y%m%d%H'))
 print fcsthrs
 print verifdates
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <js...@us...> - 2007年12月05日 17:25:40
Revision: 4623
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4623&view=rev
Author: jswhit
Date: 2007年12月05日 09:25:34 -0800 (2007年12月05日)
Log Message:
-----------
simplify time/date handling
Modified Paths:
--------------
 trunk/toolkits/basemap/examples/fcstmaps.py
Modified: trunk/toolkits/basemap/examples/fcstmaps.py
===================================================================
--- trunk/toolkits/basemap/examples/fcstmaps.py	2007年12月05日 17:11:28 UTC (rev 4622)
+++ trunk/toolkits/basemap/examples/fcstmaps.py	2007年12月05日 17:25:34 UTC (rev 4623)
@@ -37,14 +37,15 @@
 fcsttimes = data.variables['time']
 times = fcsttimes[0:6] # first 6 forecast times.
 ntimes = len(times)
-# put forecast times in YYYYMMDDHH format.
-verifdates = []
-fcsthrs=[]
-for time in times:
- print time, times[0]
- fcsthrs.append(int((time-times[0])*24))
- fdate = num2date(time,fcsttimes.units)
- verifdates.append(fdate.strftime('%Y%m%d%H'))
+# convert times for datetime instances.
+fdates = num2date(times,fcsttimes.units)
+# make a list of YYYYMMDDHH strings.
+verifdates = [fdate.strftime('%Y%m%d%H') for fdate in fdates]
+# convert times to forecast hours.
+fcsthrs = []
+for fdate in fdates:
+ fdiff = fdate-fdates[0]
+ fcsthrs.append(fdiff.days*24. + fdiff.seconds/3600.)
 print fcsthrs
 print verifdates
 lats = latitudes[:]
@@ -79,7 +80,7 @@
 m.drawparallels(numpy.arange(-80,81,20))
 m.drawmeridians(numpy.arange(0,360,20))
 # panel title
- title(repr(fcsthr)+'-h forecast valid '+verifdates[nt],fontsize=9)
+ title('%d-h forecast valid '%fcsthr+verifdates[nt],fontsize=9)
 # figure title
 figtext(0.5,0.95,u"2-m temp (\N{DEGREE SIGN}C) forecasts from %s"%verifdates[0],
 horizontalalignment='center',fontsize=14)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <js...@us...> - 2008年06月06日 18:19:56
Revision: 5413
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5413&view=rev
Author: jswhit
Date: 2008年06月06日 11:19:53 -0700 (2008年6月06日)
Log Message:
-----------
fix typos
Modified Paths:
--------------
 trunk/toolkits/basemap/examples/fcstmaps.py
Modified: trunk/toolkits/basemap/examples/fcstmaps.py
===================================================================
--- trunk/toolkits/basemap/examples/fcstmaps.py	2008年06月06日 16:57:06 UTC (rev 5412)
+++ trunk/toolkits/basemap/examples/fcstmaps.py	2008年06月06日 18:19:53 UTC (rev 5413)
@@ -12,8 +12,7 @@
 if len(sys.argv) > 1:
 YYYYMMDD = sys.argv[1]
 else:
- YYYYMMDD = datetime.datetime.today().strftime('%Y%m%d')
-YYYYMM = YYYYMMDD[0:6]
+ YYYYMMDD = datetime.datetime.today().strftime('%Y%m%d')
 
 # set OpenDAP server URL.
 URLbase="http://nomad3.ncep.noaa.gov:9090/dods/mrf/mrf"
@@ -24,7 +23,7 @@
 except:
 msg = """
 opendap server not providing the requested data.
-Try another date by providing YYYYMM on command line."""
+Try another date by providing YYYYMMDD on command line."""
 raise IOError, msg
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
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 によって変換されたページ (->オリジナル) /