Skip to content

Commit

Permalink
refactoring flatfile alias and residuals computation WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
rizac committed Sep 12, 2023
1 parent 88910bf commit be1322e
Show file tree
Hide file tree
Showing 5 changed files with 187 additions and 260 deletions.
3 changes: 2 additions & 1 deletion egsim/api/management/commands/_egsim_oq.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def populate_flatfile_column_metadata() -> list[models.FlatfileColumn]:
ret = {}
col_desc, col_bounds = {}, {}
flatfile.read_column_metadata(bounds=col_bounds, help=col_desc)
for col_name, col_type in flatfile.column_type.items():
for col_name in flatfile.column_names:
col_type = flatfile.column_type[col_name]
ff_col = models.FlatfileColumn.objects.filter(name=col_name).first()
if ff_col is None: # create (and save) object:
dtype = flatfile.column_dtype.get(col_name)
Expand Down
9 changes: 5 additions & 4 deletions egsim/smtk/flatfile-metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
# float), NaT (datetime), None/null (str or categorical), 0 (int), False
# (bool). As such, please note that int and bool do not really support
# missing data, as 0 and False also denote valid values for the dtype
# help: The field help or description. Depending on the application, a default
# might be provided (e.g. "")
# alias: A column alias, as string or list of strings. You can put here the
# Openuake name related to <column_name>, if the two differ.
# alias: The column alias(es), as string or list of strings. You can put here
# any additional name, e.g. the OpenQuake name (either parameter or distance)
# related to <column_name>, if the two differ.
# Columns of type i (intensity measure) cannot have aliases
# type: The column type. Supported values are: i (intensity measure), d
# (distance measure), r (rupture parameter), s (site parameter).
Expand All @@ -26,6 +25,8 @@
# OpenQuake implementation.
# required: Tells if the column should be always present in flatfile (default when
# missing: false)
# help: The field help or description. Depending on the application, a default
# might be provided (e.g. "")
# ">" (with quotation marks because > and < are special characters in YAML)
# The minimum value (endpoint excluded) of the column data. Currently used
# for info and not to validate or discard data (it might be in the future)
Expand Down
Loading

0 comments on commit be1322e

Please sign in to comment.