IDAES / examples

IDAES platform examples and tutorials
https://idaes-examples.readthedocs.io
Other
15 stars 36 forks source link

Update Examples to track IDAES deprecation warnings #9

Open jsiirola opened 2 years ago

jsiirola commented 2 years ago

While putting together IDAES/examples-pse#102, I ran across a ton of deprecation warnings in the example, e.g.:

2022-02-24 12:30:05 [WARNING] idaes.power_generation.unit_models.boiler_heat_exchanger: 'DeltaTMethod' is deprecated use 'HeatExchangerFlowPattern' This will be removed in IDAES 3.0
2022-02-24 12:30:05 [WARNING] idaes.power_generation.unit_models.boiler_heat_exchanger: Config item delta_T_method is deprecated use flow_pattern. Will be removed in IDAES 3.0.
2022-02-24 12:30:05 [WARNING] idaes.power_generation.unit_models.boiler_heat_exchanger: 'DeltaTMethod' is deprecated use 'HeatExchangerFlowPattern' This will be removed in IDAES 3.0
2022-02-24 12:30:05 [WARNING] idaes.power_generation.unit_models.boiler_heat_exchanger: Config item side_1_property_package is deprecated. Will be removed in IDAES 3.0.
2022-02-24 12:30:05 [WARNING] idaes.power_generation.unit_models.boiler_heat_exchanger: Config item side_2_property_package is deprecated. Will be removed in IDAES 3.0.

and

WARNING: DEPRECATED: DEPRECATED: svg_tag, the tags, tag_format and
    tag_format_default arguments are deprecated use tag_group instead.
    (deprecated in 1.12) (called from <ipython-input-8-b95b72557475>:6)
WARNING: DEPRECATED: DEPRECATED: svg_tag, the tags, tag_format and
    tag_format_default arguments are deprecated use tag_group instead.
    (deprecated in 1.12) (called from <ipython-input-8-b95b72557475>:7)

We should revisit the examples and update them to track the current recommended API.

We should also consider updating the examples tests to fail on (unexpected) warnings.

eslickj commented 2 years ago

Which model is this? Is it imported from idaes-pse or all in the example?

jsiirola commented 2 years ago

The example is src/Examples/Advanced/DataRecon/econ_parmest_testing.ipynb, importing

from idaes.power_generation.unit_models.boiler_heat_exchanger import (
    BoilerHeatExchanger, 
    TubeArrangement, 
    DeltaTMethod
)
eslickj commented 2 years ago

Ok, so it's the notebook that needs to be updated. I assume you are working on this now, so I need to wait to update it.

bpaul4 commented 2 years ago

When debugging notebooks and writing new examples, I encounter many deprecation warnings concerning missing scaling factors or not specifying an equation form for Perry's liquid density methods. The second one is from one of my PR's to add a second equation form and default to the first/original equation form is no flag is provided. @andrewlee94 would it be best to update our examples so these warnings do not appear, and if so would you support catching these warnings via tests as @jsiirola suggests above?

andrewlee94 commented 2 years ago

@bpaul4 Yes, we should be fixing these deprecation warnings and it would be good to have a check for them. This will be especially important over the next few months as we begin the transition to IDAES v2.0.

eslickj commented 2 years ago

The scaling factors aren't deprecation warnings. Just warnings. By popular request, I'm planning to add an option to silence the scaling warnings.

andrewlee94 commented 2 years ago

As John noted those the scaling factor messages are warning, but the correct path here is to fix these rather than silence them - we need to show users how to use the scaling tools and this is the prefect opportunity.

eslickj commented 2 years ago

PR https://github.com/IDAES/idaes-pse/pull/822 can turn deprecation warnings into exceptions, which can help track down the exact location of deprecation warnings being generated, and help us make sure we get them all.

andrewlee94 commented 1 year ago

I think we should have fixed all the deprecations that were being raised, so now it should just be a matter of adding a test to warn us when new deprecations appear.

lbianchi-lbl commented 1 year ago
dangunter commented 1 year ago

fwiw, in this (examples) repository, we could implement this check by using the same function used in the pre-processing step to find all notebooks (ie idaes_examples.util.find_notebooks()) and parse them. We would just need to make sure it ran after all the other tests -- there is a plugin called pytest-order we can use.

lbianchi-lbl commented 1 year ago

Summarizing the discussion from the dev call:

lbianchi-lbl commented 7 months ago

This is still relevant. I might be able to make some progress on this before the Feb release.