Skip to content

Commit

Permalink
fix issues with CityPage Weather current conditions loader (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dukestep authored Jun 14, 2024
1 parent 4d60f69 commit 13a3df4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
24 changes: 0 additions & 24 deletions deploy/default/msc-pygeoapi-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -719,30 +719,6 @@ resources:
data: ${MSC_PYGEOAPI_ES_URL}/current_conditions
id_field: identifier
time_field: timestamp
properties:
- identifier
- name
- station_en
- station_fr
- icon
- cond_en
- cond_fr
- temp
- dewpoint
- pres_en
- pres_fr
- prestnd_en
- prestnd_fr
- rel_hum
- speed
- direction_en
- direction_fr
- bearing
- timestamp
- url_en
- url_fr
- national
- nom

climate-daily:
type: collection
Expand Down
13 changes: 9 additions & 4 deletions msc_pygeoapi/loader/citypageweather_realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@
"type": "integer"
},
'speed': {
"type": "integer"
'type': 'text',
'fields': {
'raw': {
'type': 'keyword'
}
}
},
'gust': {
"type": "integer"
Expand Down Expand Up @@ -305,9 +310,9 @@ def if_none(self, type_, value):

try:
if type_ == 'f':
variable = float(value) if value else 'null'
variable = float(value) if value else None
elif type_ == 'i':
variable = int(value) if value else 'null'
variable = int(value) if value else None
except ValueError:
variable = value

Expand Down Expand Up @@ -484,7 +489,7 @@ def xml2json_cpw(self, wxo_lookup, xml):
}
}

conditions['properties'] = {key:val for key, val in conditions['properties'].items() if val != 'null'} # noqa
conditions['properties'] = {key:val for key, val in conditions['properties'].items() if val is not None} # noqa
return conditions

else:
Expand Down

0 comments on commit 13a3df4

Please sign in to comment.