{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Key IO Data Structures in SuPy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Introduction" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The cell below demonstrates a minimal case of SuPy simulation with all key IO data structures included:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2019-02-25T08:37:22.694524Z", "start_time": "2019-02-25T08:37:09.217592Z" } }, "outputs": [], "source": [ "import supy as sp\n", "df_state_init, df_forcing = sp.load_SampleData()\n", "df_output, df_state_final = sp.run_supy(df_forcing, df_state_init)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Input:\n", " SuPy requires two `DataFrame`s to perform a simulation, which are:\n", " * `df_state_init`: model initial states;\n", " * `df_forcing`: forcing data.\n", " \n", " These input data can be loaded either through calling [load_SampleData()](../auto-gen/supy.load_forcing_grid.rst#supy.load_forcing_grid) as shown above or using [init_supy](../auto-gen/supy.init_supy.rst#supy.init_supy). Or, based on the loaded sample `DataFrame`s, you can modify the content to create new `DataFrame`s for your specific needs.\n", "\n", "\n", "* Output:\n", " The output data by SuPy consists of two `DataFrame`s:\n", " * `df_output`: model output results; this is usually the basis for scientific analysis.\n", " * `df_state_final`: model final states; any of its entries can be used as a `df_state_init` to start another SuPy simulation.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Input" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### `df_state_init`: model initial states" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2019-02-25T08:37:22.749970Z", "start_time": "2019-02-25T08:37:22.696320Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
varah_minah_slope_coolingah_slope_heatingahprof_24hr...tair24hrnumcapitagridiv
ind_dim(0,)(1,)(0,)(1,)(0,)(1,)(0, 0)(0, 1)(1, 0)(1, 1)(2, 0)(2, 1)(3, 0)(3, 1)(4, 0)...(275,)(276,)(277,)(278,)(279,)(280,)(281,)(282,)(283,)(284,)(285,)(286,)(287,)00
grid
9815.015.02.72.72.72.70.570.650.450.490.430.460.40.470.4...273.15273.15273.15273.15273.15273.15273.15273.15273.15273.15273.15273.15273.15204.5898
\n", "

1 rows × 1200 columns

\n", "
" ], "text/plain": [ "var ah_min ah_slope_cooling ah_slope_heating ahprof_24hr \\\n", "ind_dim (0,) (1,) (0,) (1,) (0,) (1,) (0, 0) \n", "grid \n", "98 15.0 15.0 2.7 2.7 2.7 2.7 0.57 \n", "\n", "var ... tair24hr \\\n", "ind_dim (0, 1) (1, 0) (1, 1) (2, 0) (2, 1) (3, 0) (3, 1) (4, 0) ... (275,) \n", "grid ... \n", "98 0.65 0.45 0.49 0.43 0.46 0.4 0.47 0.4 ... 273.15 \n", "\n", "var \\\n", "ind_dim (276,) (277,) (278,) (279,) (280,) (281,) (282,) (283,) \n", "grid \n", "98 273.15 273.15 273.15 273.15 273.15 273.15 273.15 273.15 \n", "\n", "var numcapita gridiv \n", "ind_dim (284,) (285,) (286,) (287,) 0 0 \n", "grid \n", "98 273.15 273.15 273.15 273.15 204.58 98 \n", "\n", "[1 rows x 1200 columns]" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_state_init.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`df_state_init` is organised with ***grids*** in __rows__ and ***their states*** in __columns__. The details of all state variables can be found in [the description page](../data-structure/df_state.rst#df-state-variables).\n", "\n", "Please note the properties are stored as *flattened values* to fit into the tabular format due to the nature of `DataFrame` though they may actually be of higher dimension (e.g. [ahprof_24hr](../data-structure/df_state.rst#cmdoption-arg-ahprof-24hr) with the dimension {24, 2}). To indicate the variable dimensionality of these properties, SuPy use the `ind_dim` level in columns for indices of values:\n", "\n", "* `0` for scalars;\n", "* `(ind_dim1, ind_dim2, ...)` for arrays (for a generic sense, vectors are 1D arrays)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Take `ohm_coef` below for example, it has a dimension of {8, 4, 3} according to [the description](../data-structure/df_state.rst#cmdoption-arg-ohm-coef), which implies the actual values used by SuPy in simulations are passed in a layout as an array of the dimension {8, 4, 3}. As such, to get proper values passed in, users should follow the dimensionality requirement to prepare/modify `df_state_init`. " ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2019-02-25T08:37:22.787807Z", "start_time": "2019-02-25T08:37:22.751566Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ind_dim(0, 0, 0)(0, 0, 1)(0, 0, 2)(0, 1, 0)(0, 1, 1)(0, 1, 2)(0, 2, 0)(0, 2, 1)(0, 2, 2)(0, 3, 0)(0, 3, 1)(0, 3, 2)(1, 0, 0)(1, 0, 1)(1, 0, 2)...(6, 3, 0)(6, 3, 1)(6, 3, 2)(7, 0, 0)(7, 0, 1)(7, 0, 2)(7, 1, 0)(7, 1, 1)(7, 1, 2)(7, 2, 0)(7, 2, 1)(7, 2, 2)(7, 3, 0)(7, 3, 1)(7, 3, 2)
grid
980.7190.194-36.60.7190.194-36.60.7190.194-36.60.7190.194-36.60.2380.427-16.7...0.50.21-39.10.250.6-30.00.250.6-30.00.250.6-30.00.250.6-30.0
\n", "

1 rows × 96 columns

\n", "
" ], "text/plain": [ "ind_dim (0, 0, 0) (0, 0, 1) (0, 0, 2) (0, 1, 0) (0, 1, 1) (0, 1, 2) \\\n", "grid \n", "98 0.719 0.194 -36.6 0.719 0.194 -36.6 \n", "\n", "ind_dim (0, 2, 0) (0, 2, 1) (0, 2, 2) (0, 3, 0) (0, 3, 1) (0, 3, 2) \\\n", "grid \n", "98 0.719 0.194 -36.6 0.719 0.194 -36.6 \n", "\n", "ind_dim (1, 0, 0) (1, 0, 1) (1, 0, 2) ... (6, 3, 0) (6, 3, 1) \\\n", "grid ... \n", "98 0.238 0.427 -16.7 ... 0.5 0.21 \n", "\n", "ind_dim (6, 3, 2) (7, 0, 0) (7, 0, 1) (7, 0, 2) (7, 1, 0) (7, 1, 1) \\\n", "grid \n", "98 -39.1 0.25 0.6 -30.0 0.25 0.6 \n", "\n", "ind_dim (7, 1, 2) (7, 2, 0) (7, 2, 1) (7, 2, 2) (7, 3, 0) (7, 3, 1) \\\n", "grid \n", "98 -30.0 0.25 0.6 -30.0 0.25 0.6 \n", "\n", "ind_dim (7, 3, 2) \n", "grid \n", "98 -30.0 \n", "\n", "[1 rows x 96 columns]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_state_init.loc[:,'ohm_coef']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### `df_forcing`: forcing data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`df_forcing` is organised with ***temporal records*** in __rows__ and ***forcing variables*** in __columns__. The details of all forcing variables can be found in [the description page](../data-structure/df_forcing.rst#df-forcing-variables). \n", "\n", "\n", "The missing values can be specified with `-999`s, which are the default NANs accepted by SuPy and its backend SUEWS." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "ExecuteTime": { "end_time": "2019-02-25T08:37:22.823457Z", "start_time": "2019-02-25T08:37:22.789103Z" }, "scrolled": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
iyiditiminqnqhqeqsqfURHTairpresrainkdownsnowldownfcldWuhxsmdlaikdiffkdirwdirisec
2012-01-01 00:05:002012105-999.0-999.0-999.0-999.0-999.04.51585.46333311.773751001.51250.00.153333-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.00.0
2012-01-01 00:10:0020121010-999.0-999.0-999.0-999.0-999.04.51585.46333311.773751001.51250.00.153333-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.00.0
2012-01-01 00:15:0020121015-999.0-999.0-999.0-999.0-999.04.51585.46333311.773751001.51250.00.153333-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.00.0
2012-01-01 00:20:0020121020-999.0-999.0-999.0-999.0-999.04.51585.46333311.773751001.51250.00.153333-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.00.0
2012-01-01 00:25:0020121025-999.0-999.0-999.0-999.0-999.04.51585.46333311.773751001.51250.00.153333-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.00.0
\n", "
" ], "text/plain": [ " iy id it imin qn qh qe qs qf \\\n", "2012-01-01 00:05:00 2012 1 0 5 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "2012-01-01 00:10:00 2012 1 0 10 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "2012-01-01 00:15:00 2012 1 0 15 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "2012-01-01 00:20:00 2012 1 0 20 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "2012-01-01 00:25:00 2012 1 0 25 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "\n", " U RH Tair pres rain kdown \\\n", "2012-01-01 00:05:00 4.515 85.463333 11.77375 1001.5125 0.0 0.153333 \n", "2012-01-01 00:10:00 4.515 85.463333 11.77375 1001.5125 0.0 0.153333 \n", "2012-01-01 00:15:00 4.515 85.463333 11.77375 1001.5125 0.0 0.153333 \n", "2012-01-01 00:20:00 4.515 85.463333 11.77375 1001.5125 0.0 0.153333 \n", "2012-01-01 00:25:00 4.515 85.463333 11.77375 1001.5125 0.0 0.153333 \n", "\n", " snow ldown fcld Wuh xsmd lai kdiff kdir \\\n", "2012-01-01 00:05:00 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "2012-01-01 00:10:00 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "2012-01-01 00:15:00 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "2012-01-01 00:20:00 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "2012-01-01 00:25:00 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "\n", " wdir isec \n", "2012-01-01 00:05:00 -999.0 0.0 \n", "2012-01-01 00:10:00 -999.0 0.0 \n", "2012-01-01 00:15:00 -999.0 0.0 \n", "2012-01-01 00:20:00 -999.0 0.0 \n", "2012-01-01 00:25:00 -999.0 0.0 " ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_forcing.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "
\n", " \n", "**Note:**\n", "\n", "The index of `df_forcing` **SHOULD BE** strictly of `DatetimeIndex` type if you want create a `df_forcing` for SuPy simulation.\n", "The SuPy runtime time-step size is instructed by the `df_forcing` with its index information.\n", "\n", "
\n", "\n", "\n", "The infomation below indicates SuPy will run at a 5 min (i.e. 300 s) time-step if driven by this specific `df_forcing`:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2019-02-25T08:37:22.842376Z", "start_time": "2019-02-25T08:37:22.824978Z" } }, "outputs": [ { "data": { "text/plain": [ "<300 * Seconds>" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "freq_forcing=df_forcing.index.freq\n", "freq_forcing" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Output" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### `df_output`: model output results" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`df_output` is organised with ***temporal records of grids*** in __rows__ and ***output variables of different groups*** in __columns__. The details of all forcing variables can be found in [the description page](../data-structure/df_output.rst#df-output-variables). " ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "ExecuteTime": { "end_time": "2019-02-25T08:37:22.888148Z", "start_time": "2019-02-25T08:37:22.843866Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
groupSUEWS...DailyState
varKdownKupLdownLupTsurfQNQFQSQHQEQHlumpsQElumpsQHresisRainIrr...WU_Grass2WU_Grass3deltaLAILAIlumpsAlbSnowDensSnow_PavedDensSnow_BldgsDensSnow_EveTrDensSnow_DecTrDensSnow_GrassDensSnow_BSoilDensSnow_Watera1a2a3
griddatetime
982012-01-01 00:05:000.1533330.018279344.310184371.98625911.775615-27.54102140.574001-46.5324362.4200643.57649349.7326059.8328040.0423270.00.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
2012-01-01 00:10:000.1533330.018279344.310184371.98625911.775615-27.54102139.724283-46.5324361.6540963.49274448.9803609.7353330.0422940.00.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
2012-01-01 00:15:000.1533330.018279344.310184371.98625911.775615-27.54102138.874566-46.5324360.8859683.41115448.2281149.6378610.0422600.00.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
2012-01-01 00:20:000.1533330.018279344.310184371.98625911.775615-27.54102138.024849-46.5324360.1157453.33166047.4758699.5403890.0422260.00.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
2012-01-01 00:25:000.1533330.018279344.310184371.98625911.775615-27.54102137.175131-46.5324359.3434883.25420046.7236239.4429170.0421920.00.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", "

5 rows × 218 columns

\n", "
" ], "text/plain": [ "group SUEWS \\\n", "var Kdown Kup Ldown Lup \n", "grid datetime \n", "98 2012-01-01 00:05:00 0.153333 0.018279 344.310184 371.986259 \n", " 2012-01-01 00:10:00 0.153333 0.018279 344.310184 371.986259 \n", " 2012-01-01 00:15:00 0.153333 0.018279 344.310184 371.986259 \n", " 2012-01-01 00:20:00 0.153333 0.018279 344.310184 371.986259 \n", " 2012-01-01 00:25:00 0.153333 0.018279 344.310184 371.986259 \n", "\n", "group \\\n", "var Tsurf QN QF QS \n", "grid datetime \n", "98 2012-01-01 00:05:00 11.775615 -27.541021 40.574001 -46.53243 \n", " 2012-01-01 00:10:00 11.775615 -27.541021 39.724283 -46.53243 \n", " 2012-01-01 00:15:00 11.775615 -27.541021 38.874566 -46.53243 \n", " 2012-01-01 00:20:00 11.775615 -27.541021 38.024849 -46.53243 \n", " 2012-01-01 00:25:00 11.775615 -27.541021 37.175131 -46.53243 \n", "\n", "group \\\n", "var QH QE QHlumps QElumps QHresis \n", "grid datetime \n", "98 2012-01-01 00:05:00 62.420064 3.576493 49.732605 9.832804 0.042327 \n", " 2012-01-01 00:10:00 61.654096 3.492744 48.980360 9.735333 0.042294 \n", " 2012-01-01 00:15:00 60.885968 3.411154 48.228114 9.637861 0.042260 \n", " 2012-01-01 00:20:00 60.115745 3.331660 47.475869 9.540389 0.042226 \n", " 2012-01-01 00:25:00 59.343488 3.254200 46.723623 9.442917 0.042192 \n", "\n", "group ... DailyState \\\n", "var Rain Irr ... WU_Grass2 WU_Grass3 deltaLAI \n", "grid datetime ... \n", "98 2012-01-01 00:05:00 0.0 0.0 ... NaN NaN NaN \n", " 2012-01-01 00:10:00 0.0 0.0 ... NaN NaN NaN \n", " 2012-01-01 00:15:00 0.0 0.0 ... NaN NaN NaN \n", " 2012-01-01 00:20:00 0.0 0.0 ... NaN NaN NaN \n", " 2012-01-01 00:25:00 0.0 0.0 ... NaN NaN NaN \n", "\n", "group \\\n", "var LAIlumps AlbSnow DensSnow_Paved DensSnow_Bldgs \n", "grid datetime \n", "98 2012-01-01 00:05:00 NaN NaN NaN NaN \n", " 2012-01-01 00:10:00 NaN NaN NaN NaN \n", " 2012-01-01 00:15:00 NaN NaN NaN NaN \n", " 2012-01-01 00:20:00 NaN NaN NaN NaN \n", " 2012-01-01 00:25:00 NaN NaN NaN NaN \n", "\n", "group \\\n", "var DensSnow_EveTr DensSnow_DecTr DensSnow_Grass \n", "grid datetime \n", "98 2012-01-01 00:05:00 NaN NaN NaN \n", " 2012-01-01 00:10:00 NaN NaN NaN \n", " 2012-01-01 00:15:00 NaN NaN NaN \n", " 2012-01-01 00:20:00 NaN NaN NaN \n", " 2012-01-01 00:25:00 NaN NaN NaN \n", "\n", "group \n", "var DensSnow_BSoil DensSnow_Water a1 a2 a3 \n", "grid datetime \n", "98 2012-01-01 00:05:00 NaN NaN NaN NaN NaN \n", " 2012-01-01 00:10:00 NaN NaN NaN NaN NaN \n", " 2012-01-01 00:15:00 NaN NaN NaN NaN NaN \n", " 2012-01-01 00:20:00 NaN NaN NaN NaN NaN \n", " 2012-01-01 00:25:00 NaN NaN NaN NaN NaN \n", "\n", "[5 rows x 218 columns]" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_output.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`df_output` are recorded at the same temporal resolution as `df_forcing`:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "ExecuteTime": { "end_time": "2019-02-25T08:37:22.907369Z", "start_time": "2019-02-25T08:37:22.889603Z" } }, "outputs": [ { "data": { "text/plain": [ "(<300 * Seconds>, True)" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "freq_out = df_output.index.levels[1].freq\n", "(freq_out, freq_out == freq_forcing)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### `df_state_final`: model final states" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`df_state_final` has the identical data structure as `df_state_init` except for the extra level `datetime` in index, which stores the temporal information associated with model states. Such structure can facilitate the reuse of it as initial model states for other simulations (e.g., diagnostics of runtime model states with `save_state=True` set in `run_supy`; or simply using it as the initial conditions for future simulations starting at the ending times of previous runs).\n", "\n", "The meanings of state variables in `df_state_final` can be found in [the description page](../data-structure/df_state.rst#df-state-variables)." ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2019-02-25T08:37:22.953533Z", "start_time": "2019-02-25T08:37:22.909034Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
varaerodynamicresistancemethodah_minah_slope_coolingah_slope_heatingahprof_24hr...wuprofm_24hrzz0m_inzdm_in
ind_dim0(0,)(1,)(0,)(1,)(0,)(1,)(0, 0)(0, 1)(1, 0)(1, 1)(2, 0)(2, 1)(3, 0)(3, 1)...(18, 0)(18, 1)(19, 0)(19, 1)(20, 0)(20, 1)(21, 0)(21, 1)(22, 0)(22, 1)(23, 0)(23, 1)000
datetimegrid
2012-01-01 00:05:0098215.015.02.72.72.72.70.570.650.450.490.430.460.40.47...-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.049.61.914.2
2013-01-01 00:05:0098215.015.02.72.72.72.70.570.650.450.490.430.460.40.47...-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.0-999.049.61.914.2
\n", "

2 rows × 1200 columns

\n", "
" ], "text/plain": [ "var aerodynamicresistancemethod ah_min \\\n", "ind_dim 0 (0,) (1,) \n", "datetime grid \n", "2012-01-01 00:05:00 98 2 15.0 15.0 \n", "2013-01-01 00:05:00 98 2 15.0 15.0 \n", "\n", "var ah_slope_cooling ah_slope_heating \\\n", "ind_dim (0,) (1,) (0,) (1,) \n", "datetime grid \n", "2012-01-01 00:05:00 98 2.7 2.7 2.7 2.7 \n", "2013-01-01 00:05:00 98 2.7 2.7 2.7 2.7 \n", "\n", "var ahprof_24hr \\\n", "ind_dim (0, 0) (0, 1) (1, 0) (1, 1) (2, 0) (2, 1) \n", "datetime grid \n", "2012-01-01 00:05:00 98 0.57 0.65 0.45 0.49 0.43 0.46 \n", "2013-01-01 00:05:00 98 0.57 0.65 0.45 0.49 0.43 0.46 \n", "\n", "var ... wuprofm_24hr \\\n", "ind_dim (3, 0) (3, 1) ... (18, 0) (18, 1) (19, 0) \n", "datetime grid ... \n", "2012-01-01 00:05:00 98 0.4 0.47 ... -999.0 -999.0 -999.0 \n", "2013-01-01 00:05:00 98 0.4 0.47 ... -999.0 -999.0 -999.0 \n", "\n", "var \\\n", "ind_dim (19, 1) (20, 0) (20, 1) (21, 0) (21, 1) (22, 0) \n", "datetime grid \n", "2012-01-01 00:05:00 98 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "2013-01-01 00:05:00 98 -999.0 -999.0 -999.0 -999.0 -999.0 -999.0 \n", "\n", "var z z0m_in zdm_in \n", "ind_dim (22, 1) (23, 0) (23, 1) 0 0 0 \n", "datetime grid \n", "2012-01-01 00:05:00 98 -999.0 -999.0 -999.0 49.6 1.9 14.2 \n", "2013-01-01 00:05:00 98 -999.0 -999.0 -999.0 49.6 1.9 14.2 \n", "\n", "[2 rows x 1200 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df_state_final.head()" ] } ], "metadata": { "file_extension": ".py", "hide_input": false, "kernelspec": { "display_name": "Python 3", "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.7.2" }, "mimetype": "text/x-python", "name": "python", "npconvert_exporter": "python", "pygments_lexer": "ipython3", "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": true, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false }, "version": 3 }, "nbformat": 4, "nbformat_minor": 2 }