From 487b51e9de019f0858c131bae71220966cde6f21 Mon Sep 17 00:00:00 2001
From: leufen1 <l.leufen@fz-juelich.de>
Date: Fri, 24 May 2019 10:08:24 +0200
Subject: [PATCH] to create plots, variable PLOT_DATA and DEBUG need to be True
 both

---
 population-density/population_file_extraction.py   | 4 ++--
 stable_night_lights/nightlights_file_extraction.py | 4 ++--
 topography-tandem-x/topography_file_extraction.py  | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/population-density/population_file_extraction.py b/population-density/population_file_extraction.py
index 5053da7..5682b47 100644
--- a/population-density/population_file_extraction.py
+++ b/population-density/population_file_extraction.py
@@ -7,7 +7,7 @@ Author: Martin Schultz, FZ Juelich (04 May 2016)
 """
 import numpy as np
 import os
-from toar_location_services.settings import DATA_DIR, DEBUG, USE_DUMMY_POPULATION_DATA
+from toar_location_services.settings import DATA_DIR, DEBUG, USE_DUMMY_POPULATION_DATA, PLOT_DATA
 import matplotlib.pyplot as plt
 
 
@@ -58,7 +58,7 @@ def read_proxydata(filename, dummy=DEBUG and USE_DUMMY_POPULATION_DATA):
     logdata = data.copy()
     logdata[logdata <= 1.e-4] = 1.e-4
 
-    if DEBUG:
+    if DEBUG and PLOT_DATA:
         plt.contourf(lonvec, latvec, np.log10(logdata))
         plt.savefig('../plots/global_population_density.png')
         plt.close()
diff --git a/stable_night_lights/nightlights_file_extraction.py b/stable_night_lights/nightlights_file_extraction.py
index 65490e9..6f65af8 100644
--- a/stable_night_lights/nightlights_file_extraction.py
+++ b/stable_night_lights/nightlights_file_extraction.py
@@ -8,7 +8,7 @@ Author: Lukas Leufen, FZ Juelich (21th May 2019)
 """
 import numpy as np
 import os
-from toar_location_services.settings import DATA_DIR, DEBUG, USE_DUMMY_STABLE_NIGHT_LIGHTS_DATA
+from toar_location_services.settings import DATA_DIR, DEBUG, USE_DUMMY_STABLE_NIGHT_LIGHTS_DATA, PLOT_DATA
 from django.contrib.gis.gdal import GDALRaster
 import matplotlib.pyplot as plt
 # import gdal
@@ -52,7 +52,7 @@ def read_proxydata(filename, dummy=DEBUG and USE_DUMMY_STABLE_NIGHT_LIGHTS_DATA)
     boundingbox = [lon0, latvec.min(), lonvec.max(), lat0]
 
     # plot data
-    if DEBUG:
+    if DEBUG and PLOT_DATA:
         plt.contourf(lonvec, latvec, data)
         plt.savefig('../plots/global_nighttime_lights.png')
         plt.close()
diff --git a/topography-tandem-x/topography_file_extraction.py b/topography-tandem-x/topography_file_extraction.py
index 9454e12..38afb60 100644
--- a/topography-tandem-x/topography_file_extraction.py
+++ b/topography-tandem-x/topography_file_extraction.py
@@ -8,7 +8,7 @@ Author: Lukas Leufen, FZ Juelich (04 December 2018)
 """
 import numpy as np
 import os
-from toar_location_services.settings import DATA_DIR, DEBUG, USE_DUMMY_TOPOGRAPHY_TANDEM_DATA
+from toar_location_services.settings import DATA_DIR, DEBUG, USE_DUMMY_TOPOGRAPHY_TANDEM_DATA, PLOT_DATA
 from django.contrib.gis.gdal import GDALRaster
 import matplotlib.pyplot as plt
 
@@ -53,7 +53,7 @@ def read_proxydata(filename, dummy=DEBUG and USE_DUMMY_TOPOGRAPHY_TANDEM_DATA):
     # set metadata
     boundingbox = [lon0, latvec.min(), lonvec.max(), lat0]
 
-    if DEBUG:
+    if DEBUG and PLOT_DATA:
         plt.contourf(lonvec, latvec, data)
         plt.savefig('../plots/topography.png')
         plt.close()
-- 
GitLab