Comments (3)
The library works as expected, but you are accessing the data in the non-timeseries way 😉 As the documentation says, with timeseries=True
the data are organized by location:
print(obs).data.keys())
# -> dict_keys(['Helsinki Kaisaniemi'])
print(obs.data["Helsinki Kaisaniemi"].keys())
# -> dict_keys(['times', 't2m', 'ws_10min', 'wg_10min', 'wd_10min', 'rh', 'td', 'r_1h', 'ri_10min', 'snow_aws', 'p_sea', 'vis', 'n_man', 'wawa'])
print(obs.data["Helsinki Kaisaniemi"]["t2m"].keys())
# -> dict_keys(['values', 'unit'])
print(obs.data["Helsinki Kaisaniemi"]["t2m"]["values"][0])
# -> 7.7
When you use the capitalized version, you are getting the same version as you'd get withtimeseries=False
, that is, not a timeseries version.
from fmiopendata.
Thank you very much @pnuu! I got it to work somehow now.
I'm very sorry if this is not the right place to ask for further instructions, but I would need help in understanding why my script does not return me enough data. I would like to download historical weather data for the past 10 years or so, but I'm unable to download even a full day of data with my current script:
print(dt.datetime.utcnow())
print(dt.timedelta(hours=9))
end_time = dt.datetime.utcnow()
start_time = end_time - dt.timedelta(hours=24)
# Convert times to properly formatted strings
start_time = start_time.isoformat(timespec="seconds") + "Z"
end_time = end_time.isoformat(timespec="seconds") + "Z"
print("Start time:", start_time, "\nEnd time:", end_time)
obs = download_stored_query("fmi::observations::weather::multipointcoverage",
args=["bbox=24.87,60.14,25.01,60.19", "bbox=24.88,60.14,25.01,60.19"
"timeseries=True"])
print("SORTED OBS DATA KEYS:", sorted(obs.data.keys()))
print(obs.data["Helsinki Kaisaniemi"].keys())
print(obs.data["Helsinki Kaisaniemi"]["t2m"].keys()) # t2m = temperature
print(obs.data["Helsinki Kaisaniemi"]["t2m"]["values"])
print(len((obs.data["Helsinki Kaisaniemi"]["times"])))
for i in range(0, len((obs.data["Helsinki Kaisaniemi"]["times"]))):
print(obs.data["Helsinki Kaisaniemi"]["times"][i])
I have tried to alter the start_time = end_time - dt.timedelta(hours=24)
"hours" to 48 or 100 or 200 but no matter what I enter, this script always returns me 72 datapoints (len((obs.data["Helsinki Kaisaniemi"]["times"])
returns 72).
What should I do in order to download more data points, so that I would be able to download for example a full month of Kaisaniemi weather data?
from fmiopendata.
I would need help in understanding why my script does not return me enough data. I would like to download historical weather data for the past 10 years or so, but I'm unable to download even a full day of data with my current script:
end_time = dt.datetime.utcnow()
start_time = end_time - dt.timedelta(hours=24)
# Convert times to properly formatted strings
start_time = start_time.isoformat(timespec="seconds") + "Z"
end_time = end_time.isoformat(timespec="seconds") + "Z"
obs = download_stored_query("fmi::observations::weather::multipointcoverage",
args=["bbox=24.87,60.14,25.01,60.19", "bbox=24.88,60.14,25.01,60.19"
"timeseries=True"])
What should I do in order to download more data points, so that I would be able to download for example a full month of Kaisaniemi weather data?
You haven't used the start_time
and end_time
in the query. and to be sure to get only data from Kaisaniemi, use the place
parameter (see FMI Open Data manual for the syntax used below). The call should be:
obs = download_stored_query("fmi::observations::weather::multipointcoverage", args=["place=kaisaniemi,helsinki", "timeseries=True", "starttime=" + start_time, "endtime=" + end_time])
As a general note, I suggest not to download 10 years of data in one go, but split it in for example 1 month chunks. That way possible network errors won't ruin the whole query, and more importantly, it will be easier on the servers at FMI.
from fmiopendata.
Related Issues (20)
- How to parse netcdf to use forecast::enfuser::airquality? HOT 2
- Non-timeseries data & HTTP Error 400: Bad Request HOT 4
- Possible bug when fetching data before January 1st 1970 HOT 1
- Possible bug when fetching data before January 1st 1970 HOT 2
- dropsonde data ei tule? HOT 1
- Forecast data download - ModuleNotFoundError: No module named 'eccodes' " HOT 6
- Use GitHub Actions instead of Travis for unit tests
- Fix deprecation warnings in WFS XML handling HOT 1
- Mast data parsing doesn't work
- Add more details to WFS html listing HOT 1
- requests module to "install_requires" HOT 1
- Available parameters for fmiopendata.wfs download_stored_query HOT 1
- Add support to the FMI timeseries endpoint, which provides CSV, JSON and XML formats HOT 2
- half an hour time shift? HOT 1
- example does not work? HOT 2
- grid data fails due to "AttributeError: module 'eccodes' has no attribute 'GribFile'" HOT 4
- Re-run examples and update README accordingly
- Download and calibrate latest radar reflectivity (dBZ) composite fails HOT 2
- TypeError in downloading and parsing the lightning data HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fmiopendata.