Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetaFileNotFoundError at /get-temperature-data/ No meta file was found amongst the files at https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate//10_minutes/air_temperature/recent/. #1272

Open
dpakprajul opened this issue Apr 10, 2024 · 3 comments

Comments

@dpakprajul
Copy link

dpakprajul commented Apr 10, 2024

Describe the Bug
I wanted to get the data from wetterdienst Germany, but couldn't get the data. I need to send the temperature data, and the weather condition (rain, no rain, sunny) etc. to the client side from the backend. I am using django for this. I tried to get the data directly from https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate//10_minutes/air_temperature/recent/, but extracting zip, calculating the data and sending again to client takes longer than 5 seconds. Hence I wanted to implement this as a alternative.

To Reproduce

  • I wanted to integrate the German weather in my opensource project. I installed the package by pip install git+https://github.com/earthobservations/wetterdienst in a virtual environment.

  • I create a url which call the function for getting the weather data from the wetter dienst.

  • When I go to the url, for example, localhost//get-temperature-data/, this function is called:

from django.http import JsonResponse
from wetterdienst import Wetterdienst
from wetterdienst.provider.dwd.observation import DwdObservationRequest, DwdObservationDataset, DwdObservationPeriod, DwdObservationResolution

def get_temperature_data(request):
    API = Wetterdienst(provider="dwd", network="observation")
    try:
        request = DwdObservationRequest(
            parameter=DwdObservationDataset.TEMPERATURE_AIR,
            resolution=DwdObservationResolution.MINUTE_10,
            period=DwdObservationPeriod.RECENT,
        )
        print("Requesting data from DWD...", request)
        stations = request.filter_by_station_id(station_id=("03404"))
        
        df = stations.df

        # Convert DataFrame to dictionary and return as JSON
        return JsonResponse(df.to_dict(), safe=False)
    except Exception as e:
        return JsonResponse({"error": str(e)}, status=500)

It gives the error:
MetaFileNotFoundError at /get-temperature-data/ No meta file was found amongst the files at https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate//10_minutes/air_temperature/recent/.

print(request) gives DwdObservationRequest(parameter=[(air_temperature/air_temperature)], resolution=10_minutes, period=[recent], start_date=None, end_date=None, humanize=True, format=long, si_units=True)

The error in the terminal,
Internal Server Error: /get-temperature-data/ Traceback (most recent call last): File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/data/projects/weather_try/my_weather/weather_app/views.py", line 14, in get_temperature_data stations = request.filter_by_station_id(station_id=("03404")) File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/provider/dwd/observation/api.py", line 501, in filter_by_station_id return super().filter_by_station_id( File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/core/timeseries/request.py", line 656, in filter_by_station_id df = self.all().df File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/core/timeseries/request.py", line 634, in all df = self._all() File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/provider/dwd/observation/api.py", line 564, in _all df = create_meta_index_for_climate_observations(dataset, self.resolution, period, self.settings) File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/provider/dwd/observation/metaindex.py", line 92, in create_meta_index_for_climate_observations meta_index = _create_meta_index_for_climate_observations(dataset, resolution, period, settings) File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/provider/dwd/observation/metaindex.py", line 148, in _create_meta_index_for_climate_observations meta_file = _find_meta_file(remote_files, url, ["beschreibung", "txt"]) File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/provider/dwd/observation/metaindex.py", line 172, in _find_meta_file raise MetaFileNotFoundError(f"No meta file was found amongst the files at {url}.") wetterdienst.exceptions.MetaFileNotFoundError: No meta file was found amongst the files at https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate//10_minutes/air_temperature/recent/. [10/Apr/2024 08:59:18] "GET /get-temperature-data/ HTTP/1.1" 500 102963 Not Found: /favicon.ico [10/Apr/2024 08:59:19] "GET /favicon.ico HTTP/1.1" 404 2264 Requesting data from DWD... DwdObservationRequest(parameter=[(air_temperature/air_temperature)], resolution=10_minutes, period=[recent], start_date=None, end_date=None, humanize=True, format=long, si_units=True) Internal Server Error: /get-temperature-data/ Traceback (most recent call last): File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/data/projects/weather_try/my_weather/weather_app/views.py", line 14, in get_temperature_data stations = request.filter_by_station_id(station_id=("03404")) File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/provider/dwd/observation/api.py", line 501, in filter_by_station_id return super().filter_by_station_id( File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/core/timeseries/request.py", line 656, in filter_by_station_id df = self.all().df File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/core/timeseries/request.py", line 634, in all df = self._all() File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/provider/dwd/observation/api.py", line 564, in _all df = create_meta_index_for_climate_observations(dataset, self.resolution, period, self.settings) File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/provider/dwd/observation/metaindex.py", line 92, in create_meta_index_for_climate_observations meta_index = _create_meta_index_for_climate_observations(dataset, resolution, period, settings) File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/provider/dwd/observation/metaindex.py", line 148, in _create_meta_index_for_climate_observations meta_file = _find_meta_file(remote_files, url, ["beschreibung", "txt"]) File "/data/projects/weather_try/myenv/lib/python3.9/site-packages/wetterdienst/provider/dwd/observation/metaindex.py", line 172, in _find_meta_file raise MetaFileNotFoundError(f"No meta file was found amongst the files at {url}.") wetterdienst.exceptions.MetaFileNotFoundError: No meta file was found amongst the files at https://opendata.dwd.de/climate_environment/CDC/observations_germany/climate//10_minutes/air_temperature/recent/. [10/Apr/2024 08:59:29] "GET /get-temperature-data/ HTTP/1.1" 500 102573

Expected behavior
I wanted some data in stations = request.filter_by_station_id(station_id=("03404"))

Screenshots
I wanted to make the output like this, where I got the data from dwd, unzipped the folder and get the data. It is laggy, hence I wanted a faster solution
image

Desktop (please complete the following information):

  • OS: Linux
  • Python-Version 3.9.2
  • Using Django
@gutzbenj
Copy link
Member

Dear @dpakprajul ,

does the issue still exist? I can't reproduce it.

@dpakprajul
Copy link
Author

Hi @gutzbenj I am still having the same problem in my Working machine stating no meta file was found amongst the files at Webaddress: . I thought there might be the issue of the server that is not letting the request to proceed (since I am Notebook and the internet connection from Work). Don't know what is happening exactly.

I couldn't reproduce this problem in my personal Notebook but got this problem instead:

error | "conversion from str to f64 failed in column 'height' for 519 out of 519 values: ["30429 20110331", "70209 20240423", … "30401 20240424"]"

Would you please give me a hint how to solve this problem?

@gutzbenj
Copy link
Member

This new issue should be fixed now! The problem with your workstation could actually be the SSL certificate. Can you confirm that you are using a custom SSL certificate?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants