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

fix issues with CityPage Weather current conditions loader #334

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading