Giter VIP home page Giter VIP logo

sr-lstm's Introduction

Spatially-Recursive LSTM Demo

This example of SR-LSTM only works on the following modules:

  1. NeuralHydrology Python library in version 1.3.0,
  2. Raven Hydrologic Modelling Framework in version 3.7,
  3. RDRS forcing data in version 2.1 downloaded from CaSPAr,
  4. Streamflow/discharge observations that in same format as the CSV files downloaded from WSC

Repository Structure

  • basinmaker -- Folder that contains the DEM and HRU data used for BasinMaker routing delineation
  • data
    • discharge_obs/ -- Folder that contains the streamflow/discharge observation CSV files
    • USGS_discharge_data.ipynb -- Jupyter notebook to convert the format of USGS data to WSC format
    • forcing_csvs/ -- Folder that will contain the lumped forcings for each subbasins, as well as the lumped forcings for the basin
    • gridded/ -- Folder that contains the gridded source dataset for calculating the static attributes
      • dem/ -- DEM data (HydroSHEDS DEM 3s, merged via rio merge *.bil na_ca_dem_3s.tif)
      • landcover/ -- Landcover data (NALCMS)
      • soil/ -- Soil data (GSDE netCDF files (BD, CLAY, GRAV, OC, SAND, SILT))
    • rdrs_downloads/ -- Folder that contains the gridded RDRS forcing data
    • routing_networks -- Folder that will contain the BasinMaker-created routing network files
  • model
    • time_series/ -- Folder that will contain the netCDF files with forcings and discharge
    • attributes/ -- Folder that will contain the CSV files with static attributes
    • basins/ -- Folder that will contain basin-IDs txtfile train_basins.txt
    • trained_model -- Folder that contains the trained LSTM lumped model files
  • raven -- Folder that contains the Raven files
  • results -- Folder that will contain the simulation results
  • scripts -- Folder that contains the SR-LSTM codes
    • derive_grid_weights.py -- Script of Grid-Weights-Generator
    • ensemble2netcdf.py -- Script that takes the pickled ensemble reults file and creates one netCDF submission file with predictions

Setup Steps

  1. Create a virtual environment in Anaconda3 using the provided srlstm_environment.yml
  2. Download the RDRS v2.1 forcings from CaSPAr and place them in data/rdrs_downloads/
  3. Download the gridded static attribute data and place them in corresponding folder under data/gridded/ and basinmaker/
  4. Place streamflow observation CSVs in data/discharge_obs/, if routing network is provided, rename the folder as *gaugeID_routing and place it in data/routing_networks
  5. Place validated NeuralHydrology LSTM model files in model/trained_model/
  6. Create a txtfile named astrain_basins.txt which contains the IDs of basins used to train the LSTM model, and place it in model/basins/
  7. Edit the input parameters in scripts/run.py, and run the script to start the simulation

Input parameters with example

  • --watershed -- the gauged basin ID
  • --experiment -- define the delineation scheme
    • 'default' -- default mode, the threshold for minimum drainage area of subbasins will be 10% of the total basin area, lakes smaller than 5km^2 will be removed
    • 'lumped' -- lumped mode, there will be no discretization
    • 'allsublake' -- all-in mode, all subbasins and lakes in the routing product will be preserved
    • 'MDAx_LAy' -- change x and y to define the threshold for subbasin area and lake area. e.g., MDA200_LA10 uses 200km^2 as the threshold to merge subbasins and 10km^2 to remove lakes
  • gauge_lat -- latitude of the basin gauge under the WGS 84 geospatial reference system. Note that Google Maps uses this geospatial reference system.
  • gauge_lon -- longitude of the basin gauge under the WGS 84 geospatial reference system.
  • start_date end_date -- the time range for simulation, use the format yyyy-mm-dd
  • save_forcing -- optional, used if you want to save the generated subbasin-level forcings

Example: os.system(f"python ./scripts/main.py --watershed 02KB001
--experiment MDA200_LA5
--gauge_lat 45.886111
--gauge_lon -77.315278
--start_date 1980-01-01
--end_date 1981-12-31
--save_forcing")

sr-lstm's People

Contributors

glenyuyuyu avatar

Stargazers

Shengli Zhu avatar Jin Xiaoyu avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.