-
Notifications
You must be signed in to change notification settings - Fork 5
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 node_id
column to Node
table
#1149
Conversation
Breaking⚠️ - Document changes - Make sure that existing scripts still work - Adapt tests
9820b73
to
156d26f
Compare
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.
This is good to merge from my side, if you can still add upgrade information with a script, similar to #992.
You want me to add a script which purpose is to adapt an existing Ribasim model so that it can be read by an up-to-date version of Ribasim Python? |
Yeah, using Ribasim Python if possible or sqlite3 if not. I know it is a bit of a hassle, but otherwise it becomes impossible to debug user models. |
I can take a look, but would be curious about the motivation. |
You can take an older Ribasim Python to load the model, but to debug possible issues we need to be able to run the core on the main branch. Ideally it is always fully reproducible and we can just regenerate models with scripts, but that is often not possible. Only for our test models it is that simple. I think at some point we should start making an upgrade script that automatically updates models to the current version. For that to work we should start adding |
Breaking⚠️ - Document changes - Make sure that existing scripts still work - Adapt tests - Add update script for - Adding `node_id` to `Node` table if it doesn't exist already - Renaming `type` to `node_type` in `Node` table ```python import geopandas as gpd path = "path/to/database.gpkg" # Load the GeoPackage as a GeoDataFrame gdf = gpd.read_file(path, layer="Node") # Rename the column "type" to "node_type" gdf.rename(columns={"type": "node_type"}, inplace=True) # Add a new column "node_id" with the values of the index gdf["node_id"] = gdf.index # Save it back to a GeoPackage gdf.to_file(path, layer="Node", driver="GPKG") ```
Breaking⚠️
node_id
toNode
table if it doesn't exist alreadytype
tonode_type
inNode
tableUpgrade information