From 867581bbf73bf00926e166048fe1b1c9e0dd6ac4 Mon Sep 17 00:00:00 2001 From: Carsten Hinz <c.hinz@fz-juelich.de> Date: Fri, 26 Apr 2024 09:44:56 +0200 Subject: [PATCH] notebook is now running. made adoptions to the updates by Simon --- tests/quality_controll.ipynb | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/quality_controll.ipynb b/tests/quality_controll.ipynb index cc93285..31c65a7 100644 --- a/tests/quality_controll.ipynb +++ b/tests/quality_controll.ipynb @@ -30,9 +30,11 @@ "\n", "\n", "endpoint = \"https://toar-data.fz-juelich.de/api/v2/analysis/statistics/\"\n", - "toargridding_base_path = Path(\"/home/simon/Projects/toar/toargridding/\")\n", - "cache_dir = toargridding_base_path / \"tests\" / \"results\"\n", - "data_download_dir = toargridding_base_path / \"tests\" / \"data\"\n", + "#starts in diretory [path/to/toargridding]/tests\n", + "#maybe adopt the toargridding_base_path for your machine.\n", + "toargridding_base_path = Path(\".\")\n", + "cache_dir = toargridding_base_path / \"cache\"\n", + "data_download_dir = toargridding_base_path / \"data\"\n", "\n", "analysis_service = AnalysisServiceDownload(endpoint, cache_dir, data_download_dir)\n", "my_grid = RegularGrid(1.9, 2.5)\n", @@ -40,8 +42,9 @@ "time = TimeSample(dt(2016,1,1), dt(2016,12,31), \"daily\")\n", "metadata = Metadata.construct(\"mole_fraction_of_ozone_in_air\", \"mean\", time)\n", "\n", - "with open(\"data/daily_2010-01-01_2011-01-01.zip\", \"r+b\") as sample_file:\n", - " response_content = sample_file.read()" + "#not used in this notebook\n", + "#with open(\"data/daily_2010-01-01_2011-01-01.zip\", \"r+b\") as sample_file:\n", + "# response_content = sample_file.read()" ] }, { @@ -50,6 +53,7 @@ "metadata": {}, "outputs": [], "source": [ + "# this cell can runs longer than 30minutes\n", "data = analysis_service.get_data(metadata)\n", "ds = my_grid.as_xarray(data)" ] @@ -67,13 +71,15 @@ "metadata": {}, "outputs": [], "source": [ + "#calculation of coordinates for plotting\n", + "\n", "import cartopy.crs as ccrs\n", "import matplotlib.pyplot as plt\n", "import matplotlib.ticker as mticker\n", "\n", "mean_data = ds[\"mean\"]\n", - "clean_coords = analysis_service.get_clean_coords(timeseries_metadata)\n", - "all_na = timeseries.isna().all(axis=1)\n", + "clean_coords = data.stations_coords\n", + "all_na = data.stations_data.isna().all(axis=1)\n", "clean_coords = all_na.to_frame().join(clean_coords)[[\"latitude\", \"longitude\"]]\n", "all_na_coords = clean_coords[all_na]\n", "not_na_coords = clean_coords[~all_na]" @@ -87,6 +93,7 @@ "source": [ "import matplotlib as mpl\n", "\n", + "#definition of plot function\n", "\n", "def plot_cells(data, stations, na_stations, discrete=True, plot_stations=False):\n", " fig = plt.figure(figsize=(9, 18))\n", @@ -196,7 +203,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.8" + "version": "3.11.5" } }, "nbformat": 4, -- GitLab