@@ -189,26 +189,29 @@ def load_downhill_runs_from_download_pl() -> pl.DataFrame:
189
189
openskimap_source_to_url (** source ) for source in run_properties ["sources" ]
190
190
)
191
191
coordinates = run ["geometry" ]["coordinates" ]
192
- row ["run_coordinates_raw" ] = [
193
- x .model_dump () for x in _structure_coordinates (coordinates )
194
- ]
192
+ row ["run_coordinates_raw_count" ] = len (coordinates )
195
193
row ["run_coordinates_clean" ] = [
196
194
x .model_dump ()
197
195
for x in _structure_coordinates (_clean_coordinates (coordinates ))
198
196
]
197
+ row ["run_coordinates_filter_count" ] = len (coordinates ) - len (
198
+ row ["run_coordinates_clean" ]
199
+ )
199
200
# do we ever need to reverse the elevation profile (e.g. if run coordinates are reversed)?
200
201
if elev_profile := run_properties ["elevationProfile" ]:
201
202
assert elev_profile ["resolution" ] == 25
203
+ # It is not a great solution to just filter the missing elevation values,
204
+ # especially without changing the resolution.
202
205
row ["run_elevation_profile" ] = [
203
- round (x , 2 ) for x in elev_profile ["heights" ]
206
+ round (x , 2 ) for x in elev_profile ["heights" ] if x is not None
204
207
]
205
208
else :
206
209
row ["run_elevation_profile" ] = None
207
210
rows .append (row )
208
211
set_variables (
209
212
openskimap__runs__counts__02_linestring = len (rows ),
210
213
openskimap__runs__coordinates__counts__01_raw = sum (
211
- len ( row ["run_coordinates_raw" ]) for row in rows
214
+ row ["run_coordinates_raw_count" ] for row in rows
212
215
),
213
216
openskimap__runs__coordinates__counts__02_clean = sum (
214
217
len (row ["run_coordinates_clean" ]) for row in rows
@@ -218,13 +221,13 @@ def load_downhill_runs_from_download_pl() -> pl.DataFrame:
218
221
set_variables (
219
222
openskimap__runs__counts__03_downhill = len (rows ),
220
223
openskimap__runs__coordinates__counts__03_downhill_raw = sum (
221
- len ( row ["run_coordinates_raw" ]) for row in rows
224
+ row ["run_coordinates_raw_count" ] for row in rows
222
225
),
223
226
openskimap__runs__coordinates__counts__04_downhill_clean = sum (
224
227
len (row ["run_coordinates_clean" ]) for row in rows
225
228
),
226
229
)
227
- return pl .DataFrame (rows , strict = False ).drop ("run_coordinates_raw " )
230
+ return pl .DataFrame (rows , strict = False ).drop ("run_coordinates_raw_count " )
228
231
229
232
230
233
def load_lifts_from_download_pl () -> pl .DataFrame :
0 commit comments