Update README with data loading samples + fixed info
Browse files- README.md +49 -1
- assets/elevation_data_sample_0_1_degree.png +2 -2
README.md
CHANGED
@@ -81,6 +81,54 @@ Data variables:
|
|
81 |
The topography data is provided in the chunks cut around each of the SMHI stations.
|
82 |
The corners of each chunk correspond to ECMWF forecast grid points.
|
83 |
|
84 |
-
Each chunk consists 361 x 361 points, spanning across 0.1° x 0.1°. (Some of the values across longitudes are NaN since apparently the Earth is not square [citation needed]).
|
85 |
|
86 |
![Sample topography map](./assets/elevation_data_sample_0_1_degree.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
The topography data is provided in the chunks cut around each of the SMHI stations.
|
82 |
The corners of each chunk correspond to ECMWF forecast grid points.
|
83 |
|
84 |
+
Each chunk consists approximately 361 x 361 points, spanning across 0.1° x 0.1°. (Some of the values across longitudes are NaN since apparently the Earth is not square [citation needed]).
|
85 |
|
86 |
![Sample topography map](./assets/elevation_data_sample_0_1_degree.png)
|
87 |
+
|
88 |
+
## Loading the data
|
89 |
+
|
90 |
+
The dependencies can be installed through `conda` or `mamba` in the following way:
|
91 |
+
|
92 |
+
```bash
|
93 |
+
mamba create -n ourenv python pandas xarray dask netCDF4
|
94 |
+
```
|
95 |
+
|
96 |
+
---
|
97 |
+
|
98 |
+
Below, for a given SMHI weather observation station, we read the following data:
|
99 |
+
- weather observations
|
100 |
+
- historical ECMWF weather forecasts
|
101 |
+
- topography/elevation
|
102 |
+
|
103 |
+
```python
|
104 |
+
import pandas as pd
|
105 |
+
import xarray as xr
|
106 |
+
|
107 |
+
smhi_weather_observation_station_index = 153
|
108 |
+
smhi_weather_observation_station_id = pd.read_csv(
|
109 |
+
'./smhi_weather_observation_stations.csv',
|
110 |
+
index_col='station_index'
|
111 |
+
).loc[smhi_weather_observation_station_index]['id'] # 102540
|
112 |
+
|
113 |
+
weather_parameter = 1 # temperature
|
114 |
+
|
115 |
+
# NOTE: Need to unzip the file first!
|
116 |
+
smhi_observation_data = pd.read_csv(
|
117 |
+
'./weather_observations/smhi_observations_from_2020/'
|
118 |
+
f'parameter_{weather_parameter}'
|
119 |
+
f'/smhi_weather_param_{weather_parameter}_station_{smhi_weather_observation_station_id}.csv',
|
120 |
+
sep=';',
|
121 |
+
)
|
122 |
+
print(smhi_observation_data)
|
123 |
+
|
124 |
+
ecmwf_data = xr.open_dataset(
|
125 |
+
'./ecmwf_historical_weather_forecasts/ECMWF_HRES-reindexed.nc'
|
126 |
+
).sel(station_index=smhi_weather_observation_station_index)
|
127 |
+
print(ecmwf_data)
|
128 |
+
|
129 |
+
topography_data = xr.open_dataset(
|
130 |
+
'topography/sweden_chunks_copernicus-dem-30m'
|
131 |
+
f'/topography_chunk_station_index-{smhi_weather_observation_station_index}.nc'
|
132 |
+
)
|
133 |
+
print(topography_data)
|
134 |
+
```
|
assets/elevation_data_sample_0_1_degree.png
CHANGED
Git LFS Details
|
Git LFS Details
|