IN-CORE / pyincore

pyIncore is a component of IN-CORE. It is a python package consisting of two primary components: 1) a set of service classes to interact with the IN-CORE web services, and 2) IN-CORE analyses . The pyIncore allows users to apply various hazards to infrastructure in selected areas, propagating the effect of physical infrastructure damage and loss of functionality to social and economic impacts.
Mozilla Public License 2.0
25 stars 7 forks source link

608 equity metrics calculation #612

Closed longshuicy closed 1 month ago

longshuicy commented 2 months ago

Equity Metric takes 3 input:

I made the algorithm generic regardless of what scarce resource and division decision variable


To test:

run tests/pyincore/analyses/equitymetric/test_equitymetric.py

navarroc commented 2 months ago

Since this is a new analysis, we need to update the pyincore doc folder so the methods get attended to the pyincore documentation.

navarroc commented 1 month ago

@longshuicy It's minor, but can you add the equitymetrics analysis to the modules.rst in the docs folder? Thanks!

navarroc commented 1 month ago

I noticed that there is a file written "scarce_resource" in the test folder when the analysis exits. Is that supposed to be there? I only see one output listed in the spec.

longshuicy commented 1 month ago

I noticed that there is a file written "scarce_resource" in the test folder when the analysis exits. Is that supposed to be there? I only see one output listed in the spec.

That's the example I'm preparing the input datasets.

# prepare input dataset
    return_df = Dataset.from_data_service(
        "66d7763b43810e1298b0e8b1", datasvc
    ).get_dataframe_from_csv()
    scarce_resource_df = EquityMetricUtil.prepare_return_time_as_scarce_resource(
        return_df
    )
    scarce_resource = Dataset.from_dataframe(
        scarce_resource_df, "scarce_resource", data_type="incore:scarceResource"
    )

Since anything could be scarce resources, if anyone has brought in their own, they don't have the run above code to generate that input.

ywkim312 commented 1 month ago

The test run finished without error and did not create any result or any output. The code looks like it doesn't produce any output. This is okay, right?

longshuicy commented 1 month ago

The test run finished without error and did not create any result or any output. The code looks like it doesn't produce any output. This is okay, right?

It should produce 2 files. The .csv is the final output. Could you double check how you run the test file? I saw you approved the notebook, assuming it should run file with jupyter notebook. Thanks!

image