#!/usr/bin/env python # coding: utf-8 # # Res1D - Modifying a res1d file # In[1]: import mikeio1d # In[2]: res = mikeio1d.open("../tests/testdata/network.res1d") res # Let's load all node water level time series: # In[3]: df = res.nodes.WaterLevel.read(column_mode="all") print("Current maximum water level: ", df.max().max()) # Multiply the water level data by a factor of 2, and apply it to the mikeio1d.res1d object. # In[4]: df = df * 2 res.modify(df) df = res.nodes.WaterLevel.read(column_mode="all") print("Current maximum water level: ", df.max().max()) # The modification only exists in memory. Write it to a file. # In[5]: res.save("new.res1d") # In[6]: res = mikeio1d.open("new.res1d") df = res.nodes.WaterLevel.read(column_mode="all") print("Current maximum water level: ", df.max().max()) # Clean up the file created # In[7]: import os os.remove("new.res1d")