diff --git a/README.md b/README.md index 35c8a29b8192c23fddbf387815112710e4da2ec2..2f04d66a9e1e06bb0c50cad095897056214e32c9 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ TBD, see pyproject.toml Move to the folder you want to create download this project to. We now need to download the source code (https://gitlab.jsc.fz-juelich.de/esde/toar-public/toargridding/-/tree/dev?ref_type=heads). Either as ZIP folder or via git: +## Download with GIT Clone the project from its git repository: ``` git clone https://gitlab.jsc.fz-juelich.de/esde/toar-public/toargridding.git @@ -32,6 +33,7 @@ cd toargridding git checkout dev ``` +## Installing Dependencies The handling of required packages is done with poetry. So run poetry in the project directory: ``` @@ -46,17 +48,21 @@ There are at the moment three example provided as jupyter notebooks (https://jup tests/produce_data.ipynb ``` Provides an example on how to download data, apply gridding and save the results as netCDF files. +A possible improvement for is the exchange of the AnalysisService with AnalysisServiceDownload, which caches requests from the TOARDB. +This allows different griddings without the necessity to repeat the request to the TOARDB and subsequent download. + ## Retrieving data ``` get_sample_data.ipynb ``` -Downloads data from the TOAR database. +Downloads data from the TOAR database. The extracted data are written to disc. No further processing or gridding is done. ## Retrieving data ``` get_sample_data_manual.ipynb ``` Downloads data from the TOAR database with a manual creation of the request to the TOAR database. +This example does not perform any gridding. ## Retriving data and visualization ``` diff --git a/tests/get_sample_data.ipynb b/tests/get_sample_data.ipynb index a5a16cf9139b1e955eadccb1790c771dcb191f5d..790b76fe32b2c4f09bc9506244a775928377ddf8 100644 --- a/tests/get_sample_data.ipynb +++ b/tests/get_sample_data.ipynb @@ -43,70 +43,12 @@ "\n", "analysis_service = AnalysisServiceDownload(statistics_endpoint, cache_dir, download_dir)\n", "\n", - "analysis_service.get_data(metadata)\n", + "results = analysis_service.get_data(metadata)\n", "\n", "end_time = datetime.now()\n", "print(end_time-start_time)" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# %%script false --no-error\n", - "\n", - "# manual access to data\n", - "\n", - "import requests\n", - "\n", - "end_with_padding = end + timedelta(1)\n", - "\n", - "response = requests.get(\n", - " statistics_endpoint,\n", - " params={\n", - " \"daterange\": f\"{start.isoformat()},{end_with_padding.isoformat()}\", # 1-year\n", - " \"variable_id\": 5,\n", - " \"statistics\": statistic,\n", - " \"sampling\": sampling,\n", - " \"min_data_capture\": 0,\n", - " \"limit\": \"None\", # get all timeseries\n", - " \"format\": \"by_statistic\",\n", - " \"metadata_scheme\": \"basic\",\n", - " },\n", - ")\n", - "\n", - "print(response)\n", - "print(response.headers)\n", - "print(response.json())" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "print(response.headers[\"Content-Type\"] == \"application/json\")\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import requests\n", - "\n", - "#this hard coded link does not work.\n", - "#status_endpoint = \"https://toar-data.fz-juelich.de/api/v2/analysis/status/5ec3a54c-322c-4bce-a3f5-fdf485a56514\"\n", - "\n", - "#response = requests.get(status_endpoint)\n", - "#print(response.headers)\n", - "#print(response.json())" - ] - }, { "cell_type": "code", "execution_count": null, diff --git a/toargridding/toar_rest_client.py b/toargridding/toar_rest_client.py index 08e53fb94dfedc2e7cd5493f8b72254ef0e5ff0b..e01b3f77c96b626f61eb682e16cebf3b16586aa6 100644 --- a/toargridding/toar_rest_client.py +++ b/toargridding/toar_rest_client.py @@ -267,6 +267,8 @@ class AnalysisService: ---------- metadata: meta data for the request. + return: + Requested data and statistics, station coordinates and metadata of the request """ timeseries, timeseries_metadata = self.get_timeseries_and_metadata(metadata)