Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why duplicate links are created while using matrix command? #72

Open
mlmaskey opened this issue Jan 30, 2021 · 0 comments
Open

Why duplicate links are created while using matrix command? #72

mlmaskey opened this issue Jan 30, 2021 · 0 comments

Comments

@mlmaskey
Copy link

@nickrsan, @msdogan, and others,
cc @josue-medellin

I explored the CALVIN network adding 13 nodes near the Tulare Lake basin as additional agriculture demand to transfer from the SWAT model. These nodes are AS14a, b, AS15a, b, ..., AS21a,b,c with appropriate links to GW nodes and similar penalty functions as CVPMs has. I succeeded in exporting the matrix file for the Python version of the CALVIN. However, a couple of links like A408B.1921-10-31_DBUGSNK.1921-10-31 are duplicated. Refer to rows 61566 and 61842 in the attached CSV file. There are more than five links that appeared to be duplicated. This issue doesn't allow creating the pyomo model completely. Later I tried to remove the duplicate rows with the following codes inside calvin.py but outside the `CALVIN class.

def remove_duplicate_rows(df): 
    """
    Removes duplicate rows 
    :param: dataframe
    :returns: modified dataframe
    """
    df1 = df.copy()
    df1['link'] = df1.i.map(str) + '_' + df1.j.map(str)
    df11 =  df1.drop_duplicates(subset='link',keep='first')
    df12 = df11.iloc[:, 0:7]
    return (df12)

Unfortunately, it was created but could not solve and gave the error message >' not supported between instances of 'NoneType' and 'float'. After removing the duplicate rows with the above routine, I noted that the number of rows reduced from 64781 to below 50000. Does any one of you have any clue on these issues? Please let me know.

Thank you..
@mlmaskey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant