From 38a3e1e6672a66a3342f41771a5045d1b61521a7 Mon Sep 17 00:00:00 2001 From: Juan Picca Date: Wed, 13 Mar 2024 11:24:26 +0100 Subject: [PATCH 1/2] Make documentation reproducible Bug-Debian: https://bugs.debian.org/790235 Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=790235;filename=0001-make-images-reproducible.patch;msg=35 Last-Update: 2025-01-30 --- doc/make.py | 2 +- doc/source/users/figures/plotdaynight.py | 7 +++++-- doc/source/users/figures/plothighsandlows.py | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/make.py b/doc/make.py index acf172328..36e81565b 100755 --- a/doc/make.py +++ b/doc/make.py @@ -7,7 +7,7 @@ import sys def html(): - os.system('sphinx-build -b html -d build/doctrees . build/html') + os.system('sphinx-build -b html -c source/ -d build/doctrees . build/html') def latex(): if sys.platform != 'win32': diff --git a/doc/source/users/figures/plotdaynight.py b/doc/source/users/figures/plotdaynight.py index ac1f7bc34..1cd20b916 100644 --- a/doc/source/users/figures/plotdaynight.py +++ b/doc/source/users/figures/plotdaynight.py @@ -1,7 +1,9 @@ +import os +import time +import datetime import numpy as np from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt -from datetime import datetime # miller projection map = Basemap(projection='mill',lon_0=180) # plot coastlines, draw label meridians and parallels. @@ -13,7 +15,8 @@ map.fillcontinents(color='coral',lake_color='aqua') # shade the night areas, with alpha transparency so the # map shows through. Use current time in UTC. -date = datetime.utcnow() +date = datetime.datetime.utcfromtimestamp( + int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))) CS=map.nightshade(date) plt.title('Day/Night Map for %s (UTC)' % date.strftime("%d %b %Y %H:%M:%S")) plt.show() diff --git a/doc/source/users/figures/plothighsandlows.py b/doc/source/users/figures/plothighsandlows.py index d9e70bb40..7f1c27261 100644 --- a/doc/source/users/figures/plothighsandlows.py +++ b/doc/source/users/figures/plothighsandlows.py @@ -2,7 +2,9 @@ plot H's and L's on a sea-level pressure map (uses scipy.ndimage.filters and netcdf4-python) """ -import datetime as dt +import os +import time +import datetime import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap, addcyclic @@ -23,7 +25,8 @@ def extrema(mat,mode='wrap',window=10): # Plot 00 UTC yesterday. url = "http://nomads.ncep.noaa.gov/dods/gfs_0p50/gfs%Y%m%d/gfs_0p50_00z" -date = dt.datetime.now() - dt.timedelta(days=1) +date = datetime.datetime.utcfromtimestamp( + int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))) - datetime.timedelta(days=1) # open OpenDAP dataset. data = Dataset(date.strftime(url)) From 825ef95fc3e5fc5833d45ceaca046b0d84f4a4bf Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Tue, 14 Oct 2025 17:32:53 +0200 Subject: [PATCH 2/2] reproducible HTML docs: set the locale Fixes variation in plotdaynight.png --- doc/make.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/make.py b/doc/make.py index 36e81565b..8fb8953a4 100755 --- a/doc/make.py +++ b/doc/make.py @@ -7,7 +7,7 @@ import sys def html(): - os.system('sphinx-build -b html -c source/ -d build/doctrees . build/html') + os.system('LC_ALL=C.UTF-8 sphinx-build -b html -c source/ -d build/doctrees . build/html') def latex(): if sys.platform != 'win32':