The differentiable parameter learning Conceptual Functional Equivalent (dCFE) is a differentiable implementation of CFE (see below). All operations of the model are coded using PyTorch to track gradients and tune model parameters. Currently the model allows gradient tracking from runoff to 9 calibration parameters (bb
, satdk
, smcmax
, slop
, Cgw
, expon
, max_gw_storage
, K_nash
, K_lf
).
Currently the model can:
- Run in synthetic mode with CFE classic soil moisture scheme and Schaake partitioning scheme
- Takes dynamic attributes from single or multiple CAMELS basins
Development in progress to:
- Debug ML mode
- Validate the model doing experiment if model recovers synthetic parameters
- Soil ODE scheme
- Xinanjiang partitioning scheme
The CFE model is designed to be a simplified and functionaly equivalent model of the National Water Model. The model code was originally written by Dr. Fred Ogden and converted to BMI-compliant format in the Next-Gen framework by NOAA-OWP. The official CFE code by Dr. Fred Oden and NOAA-OWP lives here. The Python version of the code is developed for the prototyping, research, and development. This code is developed upon the Python version and for research purpose.
Use conda to create your own env based on our environment.yml
file
conda env create -f environment.yml
conda activate dCFE
We are using Hydra to store/manage configuration files.
The main branch code is currently configured to run the CAMELS basin id #0102500 test case. If you want to use your own case, you will need to manage three config files located here:
dCFE/src/config.yaml
- The main config file. Choose appropriate
run_type
,soil_scheme
, andbasin_id
here. run_type
generate_synthetic
: to generate synthetic data. Make sure to change thesynthetic
configs.ML
: to run and train the dCFE against observed dataML_synthetic_test
: to run and test the dCFE against the synthetic data generated aftergenerate_synthetic
- The main config file. Choose appropriate
dCFE/src/models/config/base.yaml
- This holds all config values for the models
dCFE/src/data/config/<site_name>.yaml
- This holds all config values for the dataset you're working on.
dCFE/data/
- This holds all forcing (P, PET) and validation dataset (runoff)
To run the code, just run the following command inside the dCFE/src folder:
python .
See this PDF for an example of CFE gradient chain.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Project Template provided by: https://github.com/moemen95/Pytorch-Project-Template