Giter Site home page Giter Site logo

jonking93 / pdsi Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 2.0 1.13 MB

A Matlab function to calculate Palmer Drought Severity Index (PDSI) using monthly temperature and precipitation data. Can determine values for multiple sites simultaneously.

License: MIT License

MATLAB 100.00%
pdsi soil-moisture palmer-drought-severity-index potential-evapotranspiration climate paleoclimate drought drought-indices

pdsi's Introduction

pdsi

A Matlab function to calculate Palmer Drought Severity Index (PDSI) using monthly temperature and precipitation data. Can determine values for multiple sites simultaneously.

Setup

Matlab 2020b or higher is recommended, however this function should work on versions as low as 2016b.

To use, download this repository and add it to your MATLAB path.

Syntax

Please see the demo for detailed instructions on using this function. Basic syntax is:

[X, Xm, Z, PE] = pdsi(T, P, years, lats, awcs, awcu, cafecYears, timeDim, progressbar)

---- Inputs -----

T: A numeric array holding monthly temperature data at various data sites. Data should begin in a January, and end in a December. Should be in units of Celsius.

P: Monthly precipitation data. Should correspond same data sites and time steps as the temperature data. Should be in units of mm/month.

years: A two element vector indicating the first and last year of the temperature data.

lats: The latitudes of the data sites in degrees. A numeric array. Must be the same size as the temperature data, except for the monthly time dimension, which should have a length of 1.

awcs: Available water capacity of the surface layer for each site (in mm). A numeric array the same size as lats. A common default value is 25.4 mm.

awcu: Available water capacity of the underlying layer for each site (in mm). A numeric array the same size as lats. A common default value is 127 mm.

cafecYears: A two element vector indicating the first and last years of the period to use for CAFEC normalizations.

timeDim: A positive integer indicating which dimension of the temperature and precipitation data is the monthly time step. If not provided, pdsi assumes time is along the first dimension.

progressbar: An optional input that can be used to display a progress bar for long computations. A scalar logical. Set it to true to display progress.

----- Outputs -----

X: Palmer Drought Severity Index at each site in each month.

Xm: Modified PDSI at each site in each month

Z: Z indices at each site in each month.

PE: Computed potential evapotranspiration at each site in each month (in mm).

Tips for slow computations

It is usually fastest to run pdsi on all sites at once. However, the pdsi function scales poorly for very large datasets that require MATLAB to swap data to disk.

If you are experiencing slow run times, try running pdsi on chunks of data sites. Running on 1000 to 10000 sites at a time could be a good starting point.

Credits

This PDSI function is based on a script written by Dave Meko. It was updated by Jonathan King in 2020 to include the Southern Hemisphere, and to efficiently process multiple sites.

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.