dtcenter / METcalcpy

https://metcalcpy.readthedocs.io/en/latest/index.html
Apache License 2.0
16 stars 2 forks source link

Remaining reference to ARIMA in utils.py compute_std_err_from_median_variance_inflation_factor() #254

Closed bikegeek closed 1 year ago

bikegeek commented 1 year ago

Describe the Problem

In METcalcpy/metcalcpy/util/utils.py, the compute_std_err_from_median_variance_inflation_factor function is referencing the ARIMA function from statsmodels (line 958):

    arima = ARIMA(data_excursions, order=(1, 0, 0))
    ar_1 = arima.fit().arparams[0]

Expected Behavior

If a user is invoking this function, there will be a module not found error (or something to that effect) due to no ARIMA

Environment

Describe your runtime environment: 1. Machine: (e.g. HPC name, Linux Workstation, Mac Laptop) 2. OS: (e.g. RedHat Linux, MacOS) 3. Software version number(s)

To Reproduce

Describe the steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error Post relevant sample data following these instructions: https://dtcenter.org/community-code/model-evaluation-tools-met/met-help-desk#ftp

Relevant Deadlines

List relevant project deadlines here or state NONE.

Funding Source

Define the source of funding and account keys here or state NONE.

Define the Metadata

Assignee

Labels

Projects and Milestone

Define Related Issue(s)

Consider the impact to the other METplus components.

Bugfix Checklist

See the METplus Workflow for details.

bikegeek commented 1 year ago

following what was done in util.comput_std_err_from_mean(): replace this:

arima = ARIMA(data_excursions, order=(1, 0, 0)) ar_1 = arima.fit().arparams[0]

with this: ar_1 = autocor_coef(data)

bikegeek commented 1 year ago

also removed code that is no longer used (needed when invoking ARIMA):

Use excursions from the median to compute the first order auto-correlation coefficient.

    data_excursions = list()
    median = st.median(data)
    for val in data:
        if val >= median:
            data_excursions.append(1)
        else:
            data_excursions.append(0)

    arima = ARIMA(data_excursions, order=(1, 0, 0))
    ar_1 = arima.fit().arparams[0]

replaced by: ar_1 = autocor_coef(data)