Skip to content

Commit

Permalink
adding cycles and run dates to pulldown data retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
PhillipsOwen committed Apr 11, 2023
1 parent e587b0b commit ef6e84b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/common/pg_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ def get_pull_down_data(self, **kwargs) -> dict:
# get the pull-down data
sql = f"SELECT public.get_terria_pulldown_data(_grid_type:={kwargs['grid_type']}, _event_type:={kwargs['event_type']}, " \
f"_instance_name:={kwargs['instance_name']}, _met_class:={kwargs['met_class']}, _storm_name:={kwargs['storm_name']}, " \
f"_cycle:={kwargs['cycle']}, _advisory_number:={kwargs['advisory_number']}, _project_code:={kwargs['project_code']}, " \
f"_product_type:={kwargs['product_type']});"
f"_cycle:={kwargs['cycle']}, _advisory_number:={kwargs['advisory_number']}, " \
f"_run_date:={kwargs['run_date']}, _end_date:={kwargs['end_date']}, " \
f"_project_code:={kwargs['project_code']}, _product_type:={kwargs['product_type']});"

# get the pulldown data
pulldown_data = self.exec_sql('apsviz', sql)
Expand Down
10 changes: 3 additions & 7 deletions src/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,13 @@ async def get_pulldown_data(grid_type: Union[str, None] = Query(default=None), e
ret_val = 'No data found using the filter criteria selected.'
# if PSC output is requested
elif psc_output:
# get the input params into a dict
forecast_data: dict = {'advisory': advisory_number, 'datetime': run_date, 'ensembleMember': event_type, 'mesh': grid_type,
'metric': product_type, 'model': met_class, 'storm': storm_name}

# collect the choices
choices_data: dict = {'model': ('nhc' if met_class == 'tropical' else 'gfs'), 'storm': ret_val['storm_names'],
choices_data: dict = {'model': ['nhc', 'gfs'], 'storm': ret_val['storm_names'],
'mesh': ret_val['grid_types'], 'advisory': ret_val['advisory_numbers'], 'ensembleMember': ret_val['event_types'],
'metric': ret_val['product_types']}
'metric': ret_val['product_types'], 'cycle': ret_val['cycles'], 'datetime': ret_val['run_dates']}

# create a new dict for return
ret_val = {'forcast': forecast_data, 'choices': choices_data}
ret_val = {'choices': choices_data}

except Exception:
# return a failure message
Expand Down

0 comments on commit ef6e84b

Please sign in to comment.