{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Res1D - Extracting to dfs0 (and other formats)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import mikeio1d" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "<mikeio1d.Res1D>" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "res = mikeio1d.open(\"../tests/testdata/network.res1d\")\n", "res" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Extract a subset of data into a tabular-like file format" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "res.nodes.WaterLevel.to_dfs0(\"node_water_levels.dfs0\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "res.nodes.WaterLevel.to_csv(\"node_water_levels.csv\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Clean up" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "import os\n", "\n", "os.remove(\"node_water_levels.dfs0\")\n", "os.remove(\"node_water_levels.csv\")" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.7" } }, "nbformat": 4, "nbformat_minor": 2 }