diff --git a/src/plotting/postprocessing_plotting.py b/src/plotting/postprocessing_plotting.py index f469131343bc1ba4bcf5e86c1d98b95752afb275..44752d67dcacb769cf63fdbedac4b57757432abe 100644 --- a/src/plotting/postprocessing_plotting.py +++ b/src/plotting/postprocessing_plotting.py @@ -125,8 +125,6 @@ class PlotStationMap(RunEnvironment): background, but this can be adjusted by loading locally stored topography data (not implemented yet). The plot is saved under plot_path with the name station_map.pdf """ - import cartopy.crs as ccrs - import cartopy.feature as cfeature def __init__(self, generators: Dict, plot_folder: str = "."): """ @@ -137,17 +135,22 @@ class PlotStationMap(RunEnvironment): """ super().__init__() self._ax = None - self._plot(generators, plot_folder) + if self.data_store.get("hostname")[:2] in self.data_store.get("hpc_hosts"): + logging.info(f"Running on a hpc system {self.data_store.get('hostname')}. Skip {self.__class__.__name__}...") + else: + self._plot(generators, plot_folder) def _draw_background(self): """ Draw coastline, lakes, ocean, rivers and country borders as background on the map. """ - self._ax.add_feature(self.cfeature.COASTLINE.with_scale("50m"), edgecolor='black') - self._ax.add_feature(self.cfeature.LAKES.with_scale("50m")) - self._ax.add_feature(self.cfeature.OCEAN.with_scale("50m")) - self._ax.add_feature(self.cfeature.RIVERS.with_scale("50m")) - self._ax.add_feature(self.cfeature.BORDERS.with_scale("50m"), facecolor='none', edgecolor='black') + + import cartopy.feature as cfeature + self._ax.add_feature(cfeature.COASTLINE.with_scale("50m"), edgecolor='black') + self._ax.add_feature(cfeature.LAKES.with_scale("50m")) + self._ax.add_feature(cfeature.OCEAN.with_scale("50m")) + self._ax.add_feature(cfeature.RIVERS.with_scale("50m")) + self._ax.add_feature(cfeature.BORDERS.with_scale("50m"), facecolor='none', edgecolor='black') def _plot_stations(self, generators): """ @@ -156,6 +159,8 @@ class PlotStationMap(RunEnvironment): :param generators: dictionary with the plot color of each data set as key and the generator containing all stations as value. """ + + import cartopy.crs as ccrs if generators is not None: for color, gen in generators.items(): for k, v in enumerate(gen): @@ -163,7 +168,7 @@ class PlotStationMap(RunEnvironment): # station_names = gen.get_data_generator(k).meta.loc[['station_id']] IDx, IDy = float(station_coords.loc['station_lon'].values), float( station_coords.loc['station_lat'].values) - self._ax.plot(IDx, IDy, mfc=color, mec='k', marker='s', markersize=6, transform=self.ccrs.PlateCarree()) + self._ax.plot(IDx, IDy, mfc=color, mec='k', marker='s', markersize=6, transform=ccrs.PlateCarree()) def _plot(self, generators: Dict, plot_folder: str): """ @@ -172,9 +177,11 @@ class PlotStationMap(RunEnvironment): stations as value. :param plot_folder: path to save the plot """ + + import cartopy.crs as ccrs fig = plt.figure(figsize=(10, 5)) - self._ax = fig.add_subplot(1, 1, 1, projection=self.ccrs.PlateCarree()) - self._ax.set_extent([0, 20, 42, 58], crs=self.ccrs.PlateCarree()) + self._ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree()) + self._ax.set_extent([0, 20, 42, 58], crs=ccrs.PlateCarree()) self._draw_background() self._plot_stations(generators) self._save(plot_folder) diff --git a/src/run_modules/experiment_setup.py b/src/run_modules/experiment_setup.py index 47d3adb84976a30a03d035120890f062087b3d3c..71f21c7f62c26b9692b67909a693f9d645b93814 100644 --- a/src/run_modules/experiment_setup.py +++ b/src/run_modules/experiment_setup.py @@ -24,6 +24,7 @@ DEFAULT_VAR_ALL_DICT = {'o3': 'dma8eu', 'relhum': 'average_values', 'temp': 'max DEFAULT_TRANSFORMATION = {"scope": "data", "method": "standardise", "mean": "estimate"} DEFAULT_PLOT_LIST = ["PlotMonthlySummary", "PlotStationMap", "PlotClimatologicalSkillScore", "PlotTimeSeries", "PlotCompetitiveSkillScore", "PlotBootstrapSkillScore", "plot_conditional_quantiles"] +DEFAULT_HPC_HOST_LIST = ["jw", "jr"] #first part of node names for Juwels (jw) and Jureca(jr). class ExperimentSetup(RunEnvironment): @@ -48,8 +49,9 @@ class ExperimentSetup(RunEnvironment): # experiment setup self._set_param("data_path", helpers.prepare_host(sampling=sampling)) - # self._set_param("hostname", helpers.get_host()) - self._set_param("hostname", "jwc0123") + self._set_param("hostname", helpers.get_host()) + # self._set_param("hostname", "jwc0123") + self._set_param("hpc_hosts", DEFAULT_HPC_HOST_LIST) self._set_param("create_new_model", create_new_model, default=True) if self.data_store.get("create_new_model"): trainable = True diff --git a/src/run_modules/post_processing.py b/src/run_modules/post_processing.py index b32d030eff02948954ee980710b930fe36718ab9..f6f2dece85ac62f8e1739cc5068b3f0041dd4c03 100644 --- a/src/run_modules/post_processing.py +++ b/src/run_modules/post_processing.py @@ -199,7 +199,7 @@ class PostProcessing(RunEnvironment): forecast_path=path, plot_name_affix="cali-ref", plot_folder=self.plot_path) plot_conditional_quantiles(self.test_data.stations, pred_name="obs", ref_name="CNN", forecast_path=path, plot_name_affix="like-bas", plot_folder=self.plot_path) - if ("PlotStationMap" in plot_list) and (not self.data_store.get("hostname")[:2] == "jw"): + if ("PlotStationMap" in plot_list):# and (not self.data_store.get("hostname")[:2] == "jw"): PlotStationMap(generators={'b': self.test_data}, plot_folder=self.plot_path) if "PlotMonthlySummary" in plot_list: PlotMonthlySummary(self.test_data.stations, path, r"forecasts_%s_test.nc", self.target_var,