Skip to content

Add CLI for ingesting tabular forecasts and observations into EMOS - #1584

Closed
gavinevans wants to merge 43 commits into
metoppv:masterfrom
gavinevans:improver1538_tabular_ingestion_cli
Closed

Add CLI for ingesting tabular forecasts and observations into EMOS#1584
gavinevans wants to merge 43 commits into
metoppv:masterfrom
gavinevans:improver1538_tabular_ingestion_cli

Conversation

@gavinevans

@gavinevans gavinevans commented Oct 12, 2021

Copy link
Copy Markdown
Contributor

Closes: #1538

Dependent upon #1572, #1582. Note that the changes from these PRs are currently also within this PR. This PR will only be reviewed once PRs on which it depends have been merged. At that point, the diff in this PR will reduce to only a few hundred lines.

Description
This PR builds upon work done in #1582 to add an estimate_emos_coefficients_from_table CLI that converts the pandas dataframe into an iris cube (#1582) and passes that iris cube to the existing EMOS functionality.

The functionality within this CLI will be extended to support the use of an additional predictor when #1564 is merged.

Files changed in this PR:

  • estimate_emos_coefficients_from_table.py
  • test_estimate_emos_coefficients_from_table.py
  • acceptance.py
    Note that this PR does contain an update to acceptance.py to support providing a directory as a known good output in the acceptance tests. This is required for compatibility with a partitioned parquet file.

Further information is available in this comment.

Testing:

  • Ran tests and they passed OK
  • Added new tests for the new feature(s)

…gestion_cli

* improver1538_load_parquet:
  Modify environments in preparation for changes required for ingestion of forecast and observation tables.
  Extend docstring.
  Add edit to doc/source/conf.py.
  Minor edits to load_parquet functionality.
  Add a load_parquet function with unit tests.
…1538_tabular_ingestion_cli

* improver1538_tabular_ingestion_functions:
  Modify environments in preparation for changes required for ingestion of forecast and observation tables.
  Modifications to the columns expected within the truth table.
  Modifications to functions required to support converting tabular data into iris cubes.
…lar_ingestion_cli

* upstream/master:
  Retain ensemble realization numbers from the raw forecast after reordering (metoppv#1580)
…1538_tabular_ingestion_cli

* improver1538_tabular_ingestion_functions:
  Edits to expect the period column to be a timedelta64 dtype.
  Modify environments in preparation for changes required for ingestion of forecast and observation tables.
  Modifications to the columns expected within the truth table.
  Modifications to functions required to support converting tabular data into iris cubes.
…1538_tabular_ingestion_cli

* improver1538_tabular_ingestion_functions:
  Edits to expect the period column to be a timedelta64 dtype.
…1538_tabular_ingestion_cli

* improver1538_tabular_ingestion_functions:
  Modifications to use assertCubeEqual to ensure the full cubes are compared.
  Corrections to __init__.py
@gavinevans gavinevans added this to the 1.0.0 milestone Oct 12, 2021
@gavinevans gavinevans self-assigned this Oct 12, 2021
@codecov

codecov Bot commented Oct 12, 2021

Copy link
Copy Markdown

Codecov Report

Merging #1584 (bb654ea) into master (43054bd) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1584      +/-   ##
==========================================
+ Coverage   97.98%   98.03%   +0.05%     
==========================================
  Files         107      108       +1     
  Lines        9613     9829     +216     
==========================================
+ Hits         9419     9636     +217     
+ Misses        194      193       -1     
Impacted Files Coverage Δ
improver/calibration/__init__.py 100.00% <100.00%> (ø)
improver/utilities/load.py 100.00% <100.00%> (ø)
improver/regrid/grid.py 100.00% <0.00%> (ø)
improver/utilities/spatial.py 98.78% <0.00%> (ø)
...semble_copula_coupling/_scipy_continuous_distns.py 100.00% <0.00%> (ø)
...semble_copula_coupling/ensemble_copula_coupling.py 99.05% <0.00%> (+<0.01%) ⬆️
improver/calibration/utilities.py 99.07% <0.00%> (+0.03%) ⬆️
improver/calibration/ensemble_calibration.py 100.00% <0.00%> (+0.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 43054bd...bb654ea. Read the comment docs.

@gavinevans gavinevans changed the title Improver1538 tabular ingestion cli Add CLI for ingesting tabular forecasts and observations into EMOS Oct 13, 2021
@fionaRust

Copy link
Copy Markdown
Contributor

Just a note for something to come back to. We will need to filter out a certain percentile set out of the table and the percentiles will be floating point values. This might mean the extraction requires some thought.

…1538_tabular_ingestion_cli

* improver1538_tabular_ingestion_functions:
  Minor docstring amendment.
  Sort lists.
  Correction to csv files.
  Add missing unit tests.
  Minor updates to docstrings.
  Modifications following review comments.
… latitude and longitude at all and replace with those from the forecast.
…1538_tabular_ingestion_cli

* improver1538_tabular_ingestion_functions:
  Further minor docstring edit.
  Minor extended documentation edits.
  Modifications to tidy up dataframe preparation.
  Refinement and addition of tests for column name checking.
  Extended documentation updates.
  Extend docstrings.
  NOT WORKING: Working commit to try to avoid using the truth altitude, latitude and longitude at all and replace with those from the forecast.
@gavinevans

Copy link
Copy Markdown
Contributor Author

This PR will be superseded by gavinevans#16 once #1582 is merged.

@gavinevans gavinevans closed this Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support ingestion of tabular site forecasts and observations into EMOS

2 participants