Skip to content

Add input/output operations example notebook#80

Merged
davide-f merged 4 commits intomainfrom
copilot/add-input-output-example
Feb 25, 2026
Merged

Add input/output operations example notebook#80
davide-f merged 4 commits intomainfrom
copilot/add-input-output-example

Conversation

Copy link
Contributor

Copilot AI commented Feb 25, 2026

No example existed showing how to read and write SMS++ networks via pySMSpp.

Changes

  • docs/examples/io_operations.ipynb — new notebook covering:

    • Loading a network from a NetCDF file via SMSNetwork(fp)
    • Building a network programmatically (SMSNetwork, Block, Variable)
    • Saving with to_netcdf(), including force=True overwrite semantics
    • Round-trip save/reload with structural verification
  • mkdocs.yml — registers the notebook under Examples → Input/Output Operations

Example

from pysmspp import SMSNetwork, SMSFileType, Block, Variable
import numpy as np

# Load existing network
net = SMSNetwork("model.nc4")

# Build a new network and save it
sn = SMSNetwork(file_type=SMSFileType.eBlockFile)
sn.add("UCBlock", "Block_0", id="0", TimeHorizon=24, ...)
sn.to_netcdf("output.nc4")

# Reload and verify
reloaded = SMSNetwork("output.nc4")
Original prompt

This section details on the original issue you should resolve

<issue_title>Add example for input/output operations</issue_title>
<issue_description>Add example for input/output operations</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: davide-f <67809479+davide-f@users.noreply.github.com>
Copilot AI changed the title [WIP] Add example for input/output operations Add input/output operations example notebook Feb 25, 2026
Copilot AI requested a review from davide-f February 25, 2026 17:39
@davide-f davide-f marked this pull request as ready for review February 25, 2026 18:26
@davide-f davide-f merged commit b96373b into main Feb 25, 2026
14 checks passed
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

Successfully merging this pull request may close these issues.

Add example for input/output operations

2 participants