Deltares / imod-python

🐍🧰 Make massive MODFLOW models
https://deltares.github.io/imod-python/
MIT License
19 stars 3 forks source link

Metamod-python #200

Closed Manangka closed 10 months ago

Manangka commented 2 years ago

In GitLab by @Huite on Nov 5, 2021, 15:18

import abc
from collections import UserDict

import pandas as pd
import xarray as xr

import imod

class MetaMod:
    def __init__(self, metaswap_model, mf6model):
        self

    def exchange(self):
        self.mf6
        self.msw

    def write(self):
        self.msw.write()
        self.mf6.write()
        self.write_exchanges()

class MetaSwapModel(UserDict):
    def __init__(self):
        super(__class__, self).__init__()

class AbstractMetaswapPackage(abc.ABC):
    def write(path):
        return

    def from_file(path):
        return

class GridData:
    """
    This contains the Grid data. 

    All other classes do not contain geometry (maybe?).
    """
    def __init__(
        self,
        landuse,
        rootdepth,
    ):
        return

class Infiltration:
    def __init__(
        self,
        infiltration_capacity,
        downward_resistance,
        upward_resistance,
        bottom_resistance,
        extra_storage_coefficient,
    ):
        return

class BypassFlow:
    def __init__(
        self,
        fraction,
    ):
        return

class Runoff:
    def __init__(
        self
    ):
        return

class LandUse:
    def __init__(
        self,
        land_use_type,
        land_use_name,
        vegetation_type,
        jarvis_O2,
        jarvis_drought,
        feddes_p2,
        feddes_p3h,
        feddes_p3l,
        feddes_p4,
        feddes_t3hfd,
        feddes_t3lfd,
        sprinkling_head_begin_p,
        fraction_evaporation_sprinkling,
    ):
        return

class CropRotation:
    def __init__(
        self
    ):
        return

class VegetationInterception:
    def __init__(
        self
    ):
        return

class CropGrowth:
    # TODO: is this used?
    # Assert during writing that vegetation_mld == 3
    def __init__(
        self
    ):
        return

class WofostDamageCriteria:
    def __init__(
        self
    ):
        return

class SoilScalingFactors:
    def __init__(
        self,
        soil_moisture,
        conductivity,
        pressure_head,
        depth_perched_base,
    ):
        return

class InitialConditions:
    def __init__(
        self,
    ):
        return

class SavedState:
    def __init__(
        self,
    ):
        return

class SprinklingCapacity:
    def __init__(
        self
    ):
        return

class MeteorologyStations:
    def __init__(
        self
    ):
        return

class MeteorologyGrids:
    def __init__(
        self
    ):
        return

    def svat_to_grid_mapping(self):
        """???"""
        return

# TODO: ask Joachim which meteorology he wants

class FlexibleDrainage:
    def __init__(
        self,
    ):
        return

    @staticmethod
    def from_dataframe(df: pd.DataFrame):
        return LandUse(**df)

    @staticmethod
    def from_file()

metaswap_model = MetaSwapModel()
metaswap_model["griddata"] = GridData(rainfall, ETpot)
metaswap_model["land use"] = LandUse()
metaswap_model.write()

# %%

mf6model = imod.mf6.Model()
metaswap_model = imod.msw.model()
coupled_model = imod.MetaMod(
    mf6model,
    metaswap_model,
)
coupled_model.write()

# %%
# Example use

# %%
# Defaults data?

import imod

landuse_defaults = imod.data.landuse_defaults()
LandUse.from_dataframe(landuse_defaults)
Manangka commented 2 years ago

In GitLab by @Hofer-Julian on Dec 23, 2021, 12:21

I think I am going ahead and close this. I didn't find myself referring to it too often the past weeks.