leaving out all other arg properties besides "type" to save space
"landcover_snapshot_csv": {
"type": "csv",
"structure": {
"columns": {
| #!/bin/bash | |
| # Setup for a new EC2 instance for testing Dockstore | |
| # Install Dockstore (from https://staging.dockstore.org/quick-start)--------------------------------------------------------- | |
| # Install Java 11: | |
| sudo apt-get update | |
| sudo apt install -y openjdk-11-jdk | |
| #Install the dockstore command-line program and add it to the path. |
| import numpy | |
| import multiprocessing | |
| array_in = numpy.empty(1, dtype='datetime64,f4') | |
| print(array_in.dtype['f0'].metadata) # prints None | |
| # if you use queue.Queue instead, this doesn't happen | |
| q = multiprocessing.Queue() | |
| q.put(array_in) |
| from natcap.invest import carbon | |
| def format_spec(name, spec): | |
| """Format an arg spec or subsection of an arg spec into text. | |
| Works for the entire args spec, or any nested dictionary within it (individual args or parts of args). | |
| This way, the generated content can be combined into the existing user's guide | |
| at whatever level makes sense for each situation. |
| """ | |
| Script to wrap multi-line text blocks in dictionaries. | |
| Made this for InVEST model ARGS_SPECs "about" properties since I'm | |
| moving things around and it's tedious to wrap them all by hand. | |
| This could be generalized to any multi-line text block or an entire file. | |
| """ | |
| import ast | |
| import importlib | |
| import textwrap |
| import numpy | |
| import math | |
| from osgeo import gdal, osr | |
| import pygeoprocessing | |
| import timeit | |
| FLOAT_NODATA = -1 | |
| UINT8_NODATA = 255 | |
| #!/bin/sh | |
| # post-commit hook to keep one branch updated with all the changes from another | |
| # so that the target branch always has a superset of the changes in the source branch | |
| # do this by rebasing target off of source after each commit to source | |
| SOURCE_BRANCH=example/generate-docs | |
| BRANCH_TO_REBASE=task/31/models-A-D | |
| # get the current branch in the format "* branch_name" |
| import pygeoprocessing | |
| import numpy | |
| from osgeo import gdal, osr | |
| srs = osr.SpatialReference() | |
| srs.ImportFromEPSG(32731) # WGS84/UTM zone 31s | |
| projection_wkt = srs.ExportToWkt() | |
| arr = numpy.array([[0, 1, -1]], dtype=numpy.int16) | |
| base_nodata = 0 | |
| target_datatype = gdal.GDT_Int16 |
Here are some examples of how to use pygeoprocessing for reclassification. Note: tested with pygeoprocessing 2.3.2.
pygeoprocessing provides the reclassify_raster function which can handle basic cases. See the docstring for details.
import pygeoprocessing
HISTORY.rst: Model names list in comment at top of fileHISTORY.rst: note that model was addedinstaller/windows/invest_installer.nsi: windows start menu linkinstaller/windows/invest_installer.nsi: windows data downloads listMakefile: user's guide commit hashMakefile: sample data commit hashMakefile: test data commit hash (if needed)Makefile: ZIPDIRS listscripts/invest-autotest.py: add to dictionary