-
Notifications
You must be signed in to change notification settings - Fork 50
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
add LastObs reading and writing for command-line run of main_V04 with HYfeature hydrofabric #701
add LastObs reading and writing for command-line run of main_V04 with HYfeature hydrofabric #701
Conversation
df_discharge. | ||
apply(pd.Series.last_valid_index). # index of last non-nan value, each gage | ||
to_numpy() # to numpy array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, last_obs_index
returns all zeros for me (changing all discharge values to zero), however, df_discharge
is not zero.
To find the last valid value, maybe consider something like this:
df_discharge = ds[obs_discharge_id].to_dataframe().replace(to_replace=discharge_nan, value=np.nan).reset_index(level='timeInd', drop=True).stack().dropna()
last_obs_value = df_discharge.iloc[-1]
And for the index of the last value:
last_obs_index = df_discharge[df_discharge == last_obs_value].idxmax()[0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess last_obs_index is only used for row index of df_discharge, being nothing to do with make discharge zero. If you look into the final product, which is lastobs_df, the dataframe has non-zero lastobs_discharge values.
test/LowerColorado_TX_v4/lastobs/nudgingLastObs.2023-04-02_01:00:00.nc
Outdated
Show resolved
Hide resolved
test/LowerColorado_TX_v4/lastobs/nudgingLastObs.2023-04-03_01:00:00.nc
Outdated
Show resolved
Hide resolved
nothing changed.
…ps://github.com/kumdonoaa/t-route into add_lastobs_read_write_HYfeature_commandlinerun merge upstream change in __main__.py to local
Currently, reading lastobs files to create lastobs Dataframe and then writing lastobs files from run_results with updated lastobs time and values from computing mc_reach.py is only available for BMI running and command-line run for NHD hydrofabric. This PR adds such capability as well for command-line run with HYfeature hydrofabric.
Additions
Removals
Changes
Testing
Screenshots
Notes
Todos
Checklist
Testing checklist
Target Environment support
Accessibility
Other