InVEST Recreation Client.

natcap.invest.recreation.recmodel_client.delay_op(last_time, time_delay, func)

Execute func if last_time + time_delay >= current time.

  • last_time (float) – last time in seconds that func was triggered

  • time_delay (float) – time to wait in seconds since last_time before triggering func

  • func (function) – parameterless function to invoke if current_time >= last_time + time_delay


If func was triggered, return the time which it was triggered in seconds, otherwise return last_time.



Execute recreation client model on remote server.

  • args['workspace_dir'] (string) – path to workspace directory

  • args['aoi_path'] (string) – path to AOI vector

  • args['hostname'] (string) – FQDN to recreation server

  • args['port'] (string or int) – port on hostname for recreation server

  • args['start_year'] (string) – start year in form YYYY. This year is the inclusive lower bound to consider points in the PUD and regression.

  • args['end_year'] (string) – end year in form YYYY. This year is the inclusive upper bound to consider points in the PUD and regression.

  • args['grid_aoi'] (boolean) – if true the polygon vector in args['aoi_path'] should be gridded into a new vector and the recreation model should be executed on that

  • args['grid_type'] (string) – optional, but must exist if args[‘grid_aoi’] is True. Is one of ‘hexagon’ or ‘square’ and indicates the style of gridding.

  • args['cell_size'] (string/float) – optional, but must exist if args['grid_aoi'] is True. Indicates the cell size of square pixels and the width of the horizontal axis for the hexagonal cells.

  • args['compute_regression'] (boolean) – if True, then process the predictor table and scenario table (if present).

  • args['predictor_table_path'] (string) –

    required if args[‘compute_regression’] is True. Path to a table that describes the regression predictors, their IDs and types. Must contain the fields ‘id’, ‘path’, and ‘type’ where:

    • ’id’: is a <=10 character length ID that is used to uniquely describe the predictor. It will be added to the output result shapefile attribute table which is an ESRI Shapefile, thus limited to 10 characters.

    • ’path’: an absolute or relative (to this table) path to the predictor dataset, either a vector or raster type.

    • ’type’: one of the following,

      • ’raster_mean’: mean of values in the raster under the response polygon

      • ’raster_sum’: sum of values in the raster under the response polygon

      • ’point_count’: count of the points contained in the response polygon

      • ’point_nearest_distance’: distance to the nearest point from the centroid of the response polygon

      • ’line_intersect_length’: length of lines that intersect with the response polygon in projected units of AOI

      • ’polygon_area’: area of the polygon contained within response polygon in projected units of AOI

      • ’polygon_percent_coverage’: percent (0-100) of area of overlap between the predictor and each AOI grid cell

  • args['scenario_predictor_table_path'] (string) – (optional) if present runs the scenario mode of the recreation model with the datasets described in the table on this path. Field headers are identical to args['predictor_table_path'] and ids in the table are required to be identical to the predictor list.

  • args['results_suffix'] (string) – optional, if exists is appended to any output file paths.