{ "info": { "author": "Valerio Lorini, Domenico Nappo", "author_email": "valerio.lorini@ec.europa.eu,domenico.nappo@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Education", "Intended Audience :: Other Audience", "Intended Audience :: Science/Research", "License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Physics" ], "description": "# Lisflood Utilities\n\nThis repository hosts source code of LISFLOOD utilities.\nGo to [Lisflood OS page](https://ec-jrc.github.io/lisflood/) for more information.\n\nOther useful resources\n\n| **Project** | **Documentation** | **Source code** |\n| ------------------- | --------------------------------------------------------- | --------------------------------------------------------------- |\n| Lisflood | [Model docs](https://ec-jrc.github.io/lisflood-model/) | https://github.com/ec-jrc/lisflood-code |\n| | [User guide](https://ec-jrc.github.io/lisflood-code/) | |\n| Lisvap | [Docs](https://ec-jrc.github.io/lisflood-lisvap/) | https://github.com/ec-jrc/lisflood-lisvap |\n| Calibration tool | [Docs](https://ec-jrc.github.io/lisflood-calibration/) | https://github.com/ec-jrc/lisflood-calibration |\n| Lisflood Utilities | | https://github.com/ec-jrc/lisflood-utilities (this repository) |\n| Lisflood Usecases | | https://github.com/ec-jrc/lisflood-usecases |\n\n\nUser guide of each tool is placed under the relative directory in a README.md file.\n\n## pcr2nc\n\n__pcr2nc__ is a tool to convert PCRaster maps to netCDF4 files.\nIt's developed at JRC E1 directorate, as a Floods group initiative.\n\n- convert a single map into a NetCDF4 file\n- convert a time series of maps into a NetCDF4 mapstack\n- support for WGS84 and ETRS89 (LAEA) reference systems\n- fine tuning of output files (compression, significant digits, etc.)\n\n### Installation\n\nThere are two ways to install the software: one via pip tool and one by cloning the repository.\n\n#### Requisites\n\nEnsure you have properly installed the following software:\n\n- Python 3.5+\n- GDAL C library and software\n- netCDF4 C library\n\nCreate a python3 virtualenv for using the software and activate it.\n\nIf you have virtualenvwrapper:\n```bash\n$ workon pcr2nc\n```\n\nOtherwise just execute the activate script\n```bash\n$ source /path/to/virtualenvs/pcr2nc/bin/activate\n```\n\n#### Install via pip tool\n\nActivate the virtualenv and then:\n\n```bash\n$ pip install pcr2nc\n```\n\nAfter the install was complete, you still have to install the proper GDAL package,\naccording to the version of gdal library that is installed on your machine.\nYou will also need C GDAL headers to properly install python GDAL wrapper.\n\nE.g.\n\n```bash\nsudo apt-get install libgdal-dev libgdal\nexport CPLUS_INCLUDE_PATH=/usr/include/gdal\nexport C_INCLUDE_PATH=/usr/include/gdal\ngdal-config --version # 2.2.3\npip install GDAL==2.2.3\n```\n\n#### Install by cloning the repository\n\nAssuming your Python 3 virtualenv is called pcr2nc and you have virtualenvwrapper installed:\n\n```bash\ngit clone https://github.com/ec-jrc/lisflood-utilities\ncd lisflood-utilities/pcr2nc\nworkon pcr2nc\n```\n\nInstall requirements\n\n```bash\n$ pip install -r requirements.txt\n```\n\nIf GDAL library fails to install, ensure to install the same package version of the\nlibrary you have on your system.\nTo check which version of GDAL libraries you have installed on your computer, use gdal-config\n\n```bash\ngdal-config --version\n2.1\n```\n\nExample: you have installed gdal 2.1, then:\n\n```bash\n$ pip install GDAL==2.1\n$ pip install -r requirements.txt\n```\n\n### Usage\n\n> __Note:__ This guide assumes you have installed the program with pip tool.\n> If you cloned the source code instead, just substitute the executable `pcr2nc` with `python pcr2nc_script.py` that is in the root folder of the cloned project.\n\nThe tool takes three command line input arguments:\n\n- -i, --input: It can be a path to a single file, a folder or a unix-like widlcard expression like _/path/to/files/dis00*_\n- -o, --output_file: Path to the output nc file\n- -m, --metadata: Path to a yaml or json file containing configuration for the NetCDF4 output file.\n\nUnless the input is a single file, the resulting NetCDF4 file will be a mapstack according to a time dimension.\n\n#### Example of usages:\n\nInput as a folder containing PCRaster maps. In this case, the folder must contain ONLY PCraster files and the output will be a mapstack.\n\n```bash\npcr2nc -i /path/to/input/ -o /path/to/output/out.nc -m ./nc_metadata.yaml\n```\n\nInput as a path to a single map. In this case, the output won't be a mapstack.\n\n```bash\npcr2nc -i /path/to/input/pcr.map -o /path/to/output/out.nc -m ./nc_metadata.yaml\n```\n\nInput as a _Unix style pathname pattern expansion_. The output will be a mapstack. __Note that in this case the input argument must be contained in double quotes!__\n\n```bash\npcr2nc -i \"/path/to/input/pcr00*\" -o /path/to/output/out.nc -m ./nc_metadata.json\n```\n\n#### Writing metadata configuration file\n\nFormat of resulting NetCDF4 file is configured into a metadata configuration file. This file can be written in YAML or JSON format.\n\nAn example of a metadata configuration file is the following\n\n```yaml\nvariable:\n shortname: dis\n description: Discharge\n longname: discharge\n units: m3/s\n compression: 9\n least_significant_digit: 2\nsource: JRC Space, Security, Migration\nreference: JRC Space, Security, Migration\ngeographical:\n datum: WGS84\ntime:\n calendar: proleptic_gregorian\n units: days since 1996-01-01\n\n```\n\n#### Variable section\n\nIn `variable` section you can configure metadata for the main variable:\n\n- `shortname`: A short name for the variable\n- `longname`: The long name version\n- `description`: A description for humans\n- `units`: The units of the variable\n- `compression`: Optional, integer number between 1 and 9, default 0 (no compression). If present the output nc file will be compressed at this level.\n- `least_significant_digit`: Optional, integer number, default 2. From NetCDF4 documentation:\n\n> If your data only has a certain number of digits of precision\n(say for example, it is temperature data that was measured with a precision\nof 0.1 degrees), you can dramatically improve zlib compression by quantizing\n(or truncating) the data using the least_significant_digit keyword argument\nto createVariable. The least significant digit is the power of ten of the\nsmallest decimal place in the data that is a reliable value.\nFor example if the data has a precision of 0.1,\nthen setting least_significant_digit=1 will cause data the data to be\nquantized using `numpy.around(scale*data)/scale`, where `scale = 2**bits`,\nand bits is determined so that a precision of 0.1 is retained\n(in this case bits=4). Effectively, this makes the compression 'lossy'\ninstead of 'lossless', that is some precision in the data is sacrificed for the sake of disk space.\n\n#### Source and reference\n\n`source` and `reference` add information for the institution that is providing the NetCDF4 file.\n\n#### Geographical section\n\nIn `geographical` section the only setting to configure is `datum`. \nCurrently, pcr2nc supports the following list:\n\n * `WGS84`\n * `ETRS89`\n * `GISCO`\n\n#### Time section\n\nThis section is optional and is only required if the output file is a mapstack (a timeseries of georeferenced 2D arrays)\nIn this section you have to configure `units` and `calendar`.\n\n- `units`: Can be one of the following strings (replacing placeholders with the actual date):\n - `hours since YYYY-MM-DD HH:MM:SS`\n - `days since YYYY-MM-DD`\n- `calendar`: A recognized calendar identifier, like `proleptic_gregorian`, `gregorian` etc.\n\n## Cutmaps: a NetCDF files cookie-cutter\n\nThis tool accepts a template/cookie-cutter as input, along with a list of files to cut, and produces cut netcdf files. \n\n### Usage:\nThe tool accepts as input:\n\n* a mask map (either PCRaster or netCDF format) or alternatively, passing directly indices in the form min_x_ind-max_x_ind:min_y_ind-max_y_ind\n* a textfile with a list of filepaths for files to cut or alternatively a path to a folder containing netCDF files to cut \n* a path to a folder where to write cut files.\n\n#### Examples of usage:\n\nThe following command will cut all netcdf files inside _/workarea/Madeira/lai/_ folder \nand produced files will be writte in current folder. \nThe cookie-cutter that will be used is _/workarea/Madeira/maps/MaskMap/Bacia_madeira.nc_. \nThis file is a mask (boolean map with 1 only in the area of interest) where cutmaps takes the bounding box from.\nThe mask can also be in PCRaster format.\n\n```console\ncutmaps -m /workarea/Madeira/maps/MaskMap/Bacia_madeira.nc -f /workarea/Madeira/lai/ -o ./\n```\n\nIndices can also be passed as an argument (using -c argument instead of -m). Knowing your area of interest from your netCDF files, \nyou can determine indices of the array and you can pass in the form `i_min-i_max:j_min-j_max`.\n\n```console\ncutmaps -c 150-350:80:180 -f /workarea/Madeira/lai/ -o ./\n```\n\n## gfit\n\n### Introduction\n\nThe tool Gfit2 was created to extract flood warning thresholds from a map stack of daily discharge for several years, given in NetCDF format.\nIt is designed to work with any other variable as well as with different sampling (sub- or super- daily)\n\nThe tool is made of three files:\n\n1. Gfit2.sh: the main file, used to run the tool (e.g., ./Gfit2.sh ./settingFile_test.sh)\n2. settingFile_test.sh: a setting file, where paths and values of the input variables are defined. It can be renamed, as long as the correct name is called in the script (e.g.: set1.sh --> ./Gfit2.sh ./set1.sh)\n3. gfit2.r: the r script that performs the extreme value analysis\n\n### Requirements\n\nYou need to have installed the following:\n\n- CDO\n- R\n\n### How to run\nThe tool operates in a Linux environment (also as a job with qsub). To run the tool you'll need:\n- R (the script was tested with R version 3.5.0)\n- the following R packages: ncdf4, lmomco, ismev\n- CDO (the script was tested with CDO version 1.6.5.1)\n\n### What does the tool do\n\nThe Gfit2 tool performs the following steps:\n- It takes the input file in NetCDF and extract the series of annual maxima. an optional number of warm-up years ($warmup_yrs) are excluded at the beginning of the data, to remove potential spin-up effect. Also the map of average value is computed\n- An extreme value fitting is performed on each pixel of the map, using L-moments and a 2-parameter Gumbel distribution. As option, the user can limit the analysis to a specific number of years. Also, one can use the option to remove from the fitting all values smaller than the long-term average. The fitting is performed only where at least 5 annual maxima are available, otherwise a NA is returned on the output map\n- Output return level maps (corresponding to user-selected years of recurrence interval) are saved in a netcdf file (return_levels.nc) and as ascii files. If a clone map in PCRaster format is provided, maps are also saved in PCRaster (return level maps and parameters of the Gumbel distribution)\n- After the EV fitting, the tool estimates some further statistics from the long-term input file, including minimum, maximum, and different percentile maps. This part can be commented out if not of interest\n\n### Reference\n[L-Moments: Analysis and Estimation of Distributions Using Linear Combinations of Order Statistics](https://www.jstor.org/stable/2345653)\n\nHosking, J.R.M., 1990. L-Moments: Analysis and Estimation of Distributions Using Linear Combinations of Order Statistics. J. R. Stat. Soc. Ser. B Methodol. 52, 105124.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ec-jrc/lisflood-utilities", "keywords": "netCDF4,PCRaster,mapstack,lisflood,efas,glofas,ecmwf", "license": "EUPL 1.2", "maintainer": "", "maintainer_email": "", "name": "lisflood-utilities", "package_url": "https://pypi.org/project/lisflood-utilities/", "platform": "", "project_url": "https://pypi.org/project/lisflood-utilities/", "project_urls": { "Homepage": "https://github.com/ec-jrc/lisflood-utilities" }, "release_url": "https://pypi.org/project/lisflood-utilities/0.6/", "requires_dist": [ "numpy (>=1.15)", "pyyaml", "netCDF4 (>=1.3.1)", "xarray", "dask", "pandas" ], "requires_python": "", "summary": "A set of utilities for lisfloodutilities users. pcr2nc: Convert PCRaster files to netCDF; cutmaps: cut netCDF files;compare: to compare two set of netcdf files", "version": "0.6" }, "last_serial": 5959497, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "8fc687e276b1f505e6c1f81fbbe8df79", "sha256": "6199dbbcc4462d37675ca42faabc9b16a8ae2e1d214175b3b6f949b4fffd3989" }, "downloads": -1, "filename": "lisflood-utilities-0.1.tar.gz", "has_sig": false, "md5_digest": "8fc687e276b1f505e6c1f81fbbe8df79", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15639, "upload_time": "2019-08-12T13:14:46", "url": "https://files.pythonhosted.org/packages/83/a9/0cb46b2c5123d060fa3dc9519bb434d0696c67056fff457ddb02ee2a6b6d/lisflood-utilities-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "6e71d86c4b5fe412fd6365fe28ee5c59", "sha256": "576b7daf7cb1cb86bb43724513ae39e7e2f6f014c9997c99ca5f6c1240850fbe" }, "downloads": -1, "filename": "lisflood_utilities-0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "6e71d86c4b5fe412fd6365fe28ee5c59", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 22204, "upload_time": "2019-08-30T07:24:01", "url": "https://files.pythonhosted.org/packages/65/17/418ca492f9d97d4bd46b0919c6f404d9b9c92321c752a8f4c41e86434aa7/lisflood_utilities-0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "419b6823cde9abea60056a775f035fad", "sha256": "30f62306f0515c48d8edbc6be7c28a261ec4b43bf1ff3337043f773591eb723d" }, "downloads": -1, "filename": "lisflood-utilities-0.2.tar.gz", "has_sig": false, "md5_digest": "419b6823cde9abea60056a775f035fad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15664, "upload_time": "2019-08-30T07:24:03", "url": "https://files.pythonhosted.org/packages/05/f8/ea8638a686b737d7b2df35e76042acfc4a9dc693dcfb6e3c2bb3866fb4e0/lisflood-utilities-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "228e8197bfe78cb05f19b7d81ec5dafd", "sha256": "083893e000600a0017172369905eec7c8309afe414b24da6cce8517fdb7e20bf" }, "downloads": -1, "filename": "lisflood_utilities-0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "228e8197bfe78cb05f19b7d81ec5dafd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 32978, "upload_time": "2019-08-30T09:41:03", "url": "https://files.pythonhosted.org/packages/67/98/63ec1b4051a01db69ed4e70a0ed1a508e2d01f31b4d41a6b294c8525a288/lisflood_utilities-0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "220deb6fbd315e6d203327b1fc8b5ce7", "sha256": "0718d56f7563b6c2a69fa15a0416b5dc5c4d30a425c7259bc12f07beeb0ec52c" }, "downloads": -1, "filename": "lisflood-utilities-0.3.tar.gz", "has_sig": false, "md5_digest": "220deb6fbd315e6d203327b1fc8b5ce7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18849, "upload_time": "2019-08-30T09:41:05", "url": "https://files.pythonhosted.org/packages/6e/3f/d658e46f397c10003c97d4539c8c9918783807c22fc90fe37dac76498750/lisflood-utilities-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "c91fdde301cd590e8efa548a547c3e25", "sha256": "d87e16c75e7223e8555dde4f251b037ea016ab91c5a6957c48b2cfde3d1edd91" }, "downloads": -1, "filename": "lisflood_utilities-0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "c91fdde301cd590e8efa548a547c3e25", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23305, "upload_time": "2019-08-30T14:14:23", "url": "https://files.pythonhosted.org/packages/67/5c/21eeb75e06ca2ef8a2af83c09e2cfab24a7de8fc4b4ca578dfb5577b7f85/lisflood_utilities-0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "30e4113e68e9511a5415a2ce6da349ee", "sha256": "c689d92773807eba073b4e14bd4163ddc6151652958fc8c92ec56b85806583af" }, "downloads": -1, "filename": "lisflood-utilities-0.4.tar.gz", "has_sig": false, "md5_digest": "30e4113e68e9511a5415a2ce6da349ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19851, "upload_time": "2019-08-30T14:14:25", "url": "https://files.pythonhosted.org/packages/68/03/cf7c185a21e365703c905d18c78b63b922a45ef0bdcfab6443f4c0e4079c/lisflood-utilities-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "40b5ca2da11e34fdb4cb2dc5b8a82231", "sha256": "4b1ae0905d8ef8f5971cc3ff243b8e3896a648a78012125d2ef3e0f2e0dfde00" }, "downloads": -1, "filename": "lisflood_utilities-0.5-py3-none-any.whl", "has_sig": false, "md5_digest": "40b5ca2da11e34fdb4cb2dc5b8a82231", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 23803, "upload_time": "2019-09-12T08:29:37", "url": "https://files.pythonhosted.org/packages/70/bf/ea9b26a4b1de82408f7a104f458b626b024746c7619b3ba7ee4cb89a124b/lisflood_utilities-0.5-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fdeec9bc82428206c04d08ed3804ec96", "sha256": "209f938e9b32decd00fe704b4e1bd923a2fddd813a9e97450a8f3321ad76f4f1" }, "downloads": -1, "filename": "lisflood-utilities-0.5.tar.gz", "has_sig": false, "md5_digest": "fdeec9bc82428206c04d08ed3804ec96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20303, "upload_time": "2019-09-12T08:29:39", "url": "https://files.pythonhosted.org/packages/b5/37/1aecc68c033c1185ddaa01465a086c40e7b820f658ef0c962b94b0379dbe/lisflood-utilities-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "c5f6934c9c88901d6713768ea3c53e85", "sha256": "5099ee761bd11ecf24d2c0cccfe098e39f9af4d8fdcc908e7733ea4f3c786cde" }, "downloads": -1, "filename": "lisflood_utilities-0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "c5f6934c9c88901d6713768ea3c53e85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26980, "upload_time": "2019-10-11T09:52:57", "url": "https://files.pythonhosted.org/packages/fd/7b/fcefd1d7135768853c28d3d60268aef3a3af845318c7605e15d9d6e3b1b5/lisflood_utilities-0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9969c034176c8105d0ad62c9d0c107d", "sha256": "36708376cee0c4b9e3e67f1ff7c378d0e7b4a10a97b78256d6ed1138f7fb3163" }, "downloads": -1, "filename": "lisflood-utilities-0.6.tar.gz", "has_sig": false, "md5_digest": "b9969c034176c8105d0ad62c9d0c107d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21789, "upload_time": "2019-10-11T09:52:59", "url": "https://files.pythonhosted.org/packages/7a/cb/f60dc6a40a54beb973f256e955b9c731ec90eaa1150fd674a73ed31ecbcd/lisflood-utilities-0.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c5f6934c9c88901d6713768ea3c53e85", "sha256": "5099ee761bd11ecf24d2c0cccfe098e39f9af4d8fdcc908e7733ea4f3c786cde" }, "downloads": -1, "filename": "lisflood_utilities-0.6-py3-none-any.whl", "has_sig": false, "md5_digest": "c5f6934c9c88901d6713768ea3c53e85", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 26980, "upload_time": "2019-10-11T09:52:57", "url": "https://files.pythonhosted.org/packages/fd/7b/fcefd1d7135768853c28d3d60268aef3a3af845318c7605e15d9d6e3b1b5/lisflood_utilities-0.6-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9969c034176c8105d0ad62c9d0c107d", "sha256": "36708376cee0c4b9e3e67f1ff7c378d0e7b4a10a97b78256d6ed1138f7fb3163" }, "downloads": -1, "filename": "lisflood-utilities-0.6.tar.gz", "has_sig": false, "md5_digest": "b9969c034176c8105d0ad62c9d0c107d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21789, "upload_time": "2019-10-11T09:52:59", "url": "https://files.pythonhosted.org/packages/7a/cb/f60dc6a40a54beb973f256e955b9c731ec90eaa1150fd674a73ed31ecbcd/lisflood-utilities-0.6.tar.gz" } ] }