Package: fcpgtools
Flow-Conditioned Parameter Grid (FCPG) Tools DocumentationFor detailed documentation please reference ourReadTheDocs site!Note that the most recent version of this repository is available onGitLab. While mirrored on GitHub, the repos can get out of sync.Please log any issues or feature requests usingthis form.Getting StartedInstallationFCPGtoolscan be installed fromPyPIinto a virtual environment containingGDAL, and for full functionality,TauDEMas well.We strongly encourage the following installation workflow:Install the Anaconda Python Distribution or MinicondaAnaconda Individual Edition- includesconda, a complete Python (and R) data science stack, and the helpful Anaconda Navigator GUI.A lighter-weight alternative is toinstall Miniconda.Use thecondacommand line to clone our lightweightfcpgtools_basevirtual environment that contains non-Python dependencies from theenvironment.ymlfile available in our repo. Either clone the repo, or just download the .yml file locally, and run the following commands:conda env create -f {PATH}/environment.ymlNote:We also provide a more robustenvironment_dev.ymlvirtual environment for developers containing all libraries relevant to making contributions as well as running ourexample notebooks.Activate thefcpgtools_baseenvironment, and pip installfcpgtools.pip install fcpgtools(optional) pip install optional libraries required to run our demo notebook (examples/v2_fcpgtools_demo.ipynb), and to leverage in-line function completion/type-hints.pip install jupyterlab
pip install ipympl
pip install python-lsp-server
pip install jupyterlab-lsp
pip install pydaymetUsing FCPGtoolsVersion 2.0 ofFCPGtoolshas a "flat" architecture, meaning all functions can be accessed by importing the mainfcpgtoolsmodule as shown in a simple example below:# creating an flow accumulation raster from a Flow Direction Raster (FDR)importfcpgtoolspath_to_fdr=r'YOUR/PATH/HERE/fdr.tif'flow_accumulation_grid=fcpgtools.accumulate_flow(d8_fdr=path_to_fdr,)->xarray.DataArrayPlease refer to our documentation'sCookbookpage for more intricate examples of usage.CitationVersion 2.0was released in January, 2023.Barnhart, T.B., Nogueira, X.R., Siefken, S.A., Schultz, A.R., Aufenkampe, A., Tomasula, P., 2023, Flow-Conditioned Parameter Grid Tools Version 2.0.Version 1.1was released in September, 2022.Version 1.0(IP-112996) was approved on September 3, 2020.Barnhart, T.B., Sando, R., Siefken, S.A., McCarthy, P.M., and Rea, A.H., 2020, Flow-Conditioned Parameter Grid Tools: U.S. Geological Survey Software Release, DOI:https://doi.org/10.5066/P9W8UZ47.Migrating from Version 1.0Version 2.0 ofFCPGtoolsis a ground-up refactor and rebuild of Version 1.0. Backwards compatibility is broken, and many work-flows have been significantly streamlined. We strongly suggest that any users accustomed to Version 1.0 reference ourupdated documentation site.A non-exhaustive list of key updates is below:All functions output an in-memoryxarray.DataArrayobject, allowing for functions to be strung together into performance oriented pipelines.xarray.DataArrayobjects have a variety of powerful features and optimizations. For more information please reference the library'sdocumentation.Rasters can still be saved to a local GeoTIFF file by providing a valid.tifpath toparam:out_path.All functions can now accept either local string paths, localpathlib.Pathobjects, or in-memoryxarray.DataArrayobjects.Multi-band parameter grids are now supported!Example: Passing a 12-month precipitation raster (where each month is a raster band) intofcpgtools.accumulate_parameter()will output a 12-bandxarray.DataArrayobject.Flow Direction Raster format conversion (i.e. ESRI -> TauDEM) is now automated behind-the-scenes.Support for multiple "terrain engines" gives users optionality and increases dependency deprecation resiliancy.Where necessary users can setparam:enginetotaudem(default) orpysheds.Note that thepyshedsterrain engine is signifcantly more performant, however it currently only supportsaccumulate_flow()andaccumulate_parameter().Please reference our markdownrefactored_namesdocument for a complete mapping of Version 1.1 to Version 2.0 function names.DisclaimersAny use of trade, firm, or product names is for descriptive purposes only and does not imply endorsement by the U.S. Government.Please seeDISCLAIMER.mdin the project repository.LicensePlease seeLICENSE.mdin the project repository.