def list(self, after_time=None, before_time=None, epsg_code=None, limit=None, meta_string=None, offset=None, shapegrid_id=None): """Gets a list of gridsets matching the provided criteria. Args: after_time (str): Count gridsets modified after this time. before_time (str): Count gridsets modified before this time. epsg_code (int): The integer representing the map projection EPSG code for the gridsets to count. limit (int): The maximum number of records to return in this request. meta_string (str): Metadata string to use to count gridsets. offset (int): Start returned records after this offset (used for paging). shapegrid_id (int): Count gridsets built from the shapegrid with this identifier. Returns: list of dict: A list of JSON dictionaries for matching gridset metadata. """ return RestService.list(self, self.end_point, after_time=after_time, before_time=before_time, epsg_code=epsg_code, limit=limit, meta_string=meta_string, offset=offset, shapegrid_id=shapegrid_id)
def count(self, after_time=None, before_time=None, epsg_code=None, squid=None): """Counts layers matching the specified criteria. Args: after_time (:obj:`str`, optional): Matching layers are modified after this time specified in ISO-8601 format. before_time (:obj:`str`, optional): Matching layers are modified before this time specified in ISO-8601 format. epsg_code (:obj:`int`, optional): Matching layers will have the map projection specified by this EPSG code. squid (:obj:`str`, optional): Matching layers will have this hash- based species identifier. Returns: int: The number of matching layers. """ return RestService.count(self, '{}/count'.format(self.end_point), after_time=after_time, before_time=before_time, epsg_code=epsg_code, squid=squid)
def count(self, after_time=None, before_time=None, cell_sides=None, cell_size=None, epsg_code=None): """Counts shapegrids matching the provided criteria. Args: after_time (:obj:`str`, optional): Count shapegrids modified after this time (in ISO-8601 format). before_time (:obj:`str`, optional): Count shapegrids modified before this time (in ISO-8601 format). cell_sides (:obj:`int`, optional): Count shapegrids that have cells with the specified number of sides (4 - rectangles, 6 - hexagons). cell_size (:obj:`float`, optional): Count shapegrids with the specified cell size (resolution). epsg_code (:obj:`int`, optional): Count shapegrids that were created using the specified spatial projection represented by the EPSG code. Returns: int: The number of shapegrids matching the provided criteria. """ return RestService.count(self, '{}/count'.format(self.end_point), after_time=after_time, before_time=before_time, cell_sides=cell_sides, cell_size=cell_size, epsg_code=epsg_code)
def count(self, after_time=None, alt_pred_code=None, before_time=None, date_code=None, epsg_code=None, gcm_code=None): """Counts scenarios matching the provided criteria. Args: after_time (str): Count scenarios modified after this time. alt_pred_code (str): Count scenarios containing this alternate prediction code. before_time (str): Count scenarios modified before this time. date_code (str): Count scenarios with this date code. epsg_code (int): Count scenarios using this map projection EPSG code. gcm_code (str): Count scenario using this GCM code. Returns: int: The number of scenarios matching the criteria. """ return RestService.count(self, '{}/count'.format(self.end_point), after_time=after_time, alt_pred_code=alt_pred_code, before_time=before_time, date_code=date_code, epsg_code=epsg_code, gcm_code=gcm_code)
def count(self, after_time=None, before_time=None, epsg_code=None, meta_string=None, shapegrid_id=None): """Counts gridsets matching the provided criteria. Args: after_time (str): Count gridsets modified after this time. before_time (str): Count gridsets modified before this time. epsg_code (int): The integer representing the map projection EPSG code for the gridsets to count. meta_string (str): Metadata string to use to count gridsets. shapegrid_id (int): Count gridsets built from the shapegrid with this identifier. Returns: int: The number of gridsets matching the provided criteria. """ return RestService.count(self, '{}/count'.format(self.end_point), after_time=after_time, meta_string=meta_string, shapegrid_id=shapegrid_id, before_time=before_time, epsg_code=epsg_code)
def get_facets(self): """Attempts to get Global PAM facets. Returns: list of dict: A list of facets for the gridset. """ return RestService.get(self, '{}/gridset'.format(self.end_point))
def list(self, after_time=None, before_time=None, epsg_code=None, limit=None, offset=None, squid=None): """Gets a list of layers matching the specified criteria. Args: after_time (:obj:`str`, optional): Matching layers are modified after this time specified in ISO-8601 format. before_time (:obj:`str`, optional): Matching layers are modified before this time specified in ISO-8601 format. epsg_code (:obj:`int`, optional): Matching layers will have the map projection specified by this EPSG code. limit (:obj:`int`, optional): Return, at most, this many layers. offset (:obj:`int`, optional): Offset the returned layers by this amount. Useful for paging. squid (:obj:`str`, optional): Matching layers will have this hash- based species identifier. Returns: list of dicts - A list of layer dictionary objects with metadata about each one. The response format is JSON. """ return RestService.list(self, self.end_point, after_time=after_time, before_time=before_time, epsg_code=epsg_code, squid=squid, limit=limit, offset=offset)
def list(self, after_time=None, before_time=None, limit=None, offset=None, scenario_id=None): """Gets a list of scenario package matching the provided criteria. Args: after_time (str): Return scenario packages modified after this time. before_time (str): Return scenario packages modified before this time. limit (int): The maximum number of scenario packages to return. offset (int): Offset the returned scenario packages by this amount. scenario_id (int): Return scenario packages containing this scenario. Returns: list of dict: A list of JSON dictionaries of scenario package metadata for the matching scenario packages. """ return RestService.list(self, self.end_point, after_time=after_time, scenario_id=scenario_id, before_time=before_time, limit=limit, offset=offset)
def list(self, after_time=None, alt_pred_code=None, before_time=None, date_code=None, epsg_code=None, env_code=None, env_type_id=None, gcm_code=None, scenario_id=None, limit=None, offset=None): """Gets a list of environmental layers matching the specified criteria. Args: after_time (:obj:`str`, optional): Matching environmental layers are modified after this time specified in ISO-8601 format. alt_pred_code (:obj:`str`, optional): Matching environmental layers must have this alternate prediction code. before_time (:obj:`str`, optional): Matching environmental layers are modified before this time specified in ISO-8601 format. date_code (:obj:`str`, optional): Matching environmental layers will have this date code. epsg_code (:obj:`int`, optional): Matching environmental layers will have the map projection specified by this EPSG code. env_code (:obj:`str`, optional): Matching environmental layers will have this environment code. env_type_id (:obj:`str`, optional): Matching environmental layers will have this environmental layer type identifier. gcm_code (:obj:`str`, optional): Matching environmental layers will have this GCM code. scenario_id (:obj:`int`, optional): Matching environmental layers will belong to the Lifemapper scenario specified by this identifier. limit (:obj:`int`, optional): Return, at most, this many environmental layers. offset (:obj:`int`, optional): Offset the returned environmental layers by this amount. Useful for paging. Returns: list of dicts - A list of environmental layer dictionary objects with metadata about each one. The response format is JSON. """ return RestService.list(self, self.end_point, after_time=after_time, alt_pred_code=alt_pred_code, before_time=before_time, date_code=date_code, epsg_code=epsg_code, env_code=env_code, env_type_id=env_type_id, gcm_code=gcm_code, scenario_id=scenario_id, limit=limit, offset=offset)
def list(self, after_status=None, after_time=None, algorithm_code=None, before_status=None, before_time=None, display_name=None, epsg_code=None, limit=None, model_scenario_code=None, occurrence_set_id=None, offset=None, projection_scenario_code=None, scenario_id=None, status=None, gridset_id=None): """Gets a list of projections matching the provided criteria. Args: after_status (int): Return projections with a status greater than this. after_time (str): Return projections modified after this time. algorithm_code (str): Return projections built with this algorithm. before_status (int): Return projections with a status less than this. before_time (str): Return projections modified before this time. display_name (str): Return projections with this display name. epsg_code (int): Return projections using this map projection. limit (int): The maximum number of projections to return. model_scenario_code (str): Return projections built from this model. occurrence_set_id (int): Return projections built from this occurrence set. offset (int): Start returned projections after this offset. projection_scenario_code (str): Return projections using this scenario. scenario_id (int): Return projections using this scenario identifier. status (int): Return projections with this exact status. gridset_id (int): Return projections in this gridset. Returns: list of dict: A list of JSON dictionary metadata for matching scenarios. """ return RestService.list( self, self.end_point, after_time=after_time, scenario_id=scenario_id, before_time=before_time, limit=limit, offset=offset, after_status=after_status, algorithm_code=algorithm_code, before_status=before_status, display_name=display_name, epsg_code=epsg_code, model_scenario_code=model_scenario_code, status=status, occurrence_set_id=occurrence_set_id, projection_scenario_code=projection_scenario_code, gridset_id=gridset_id)
def list(self, after_time=None, agent=None, before_time=None, catalog_number=None, collection=None, ident1=None, ident2=None, operation=None, provider=None, url=None, who=None, why=None): """Lists snippets matching the provided criteria. Args: after_time (:obj:`str`, optional): Only return snippets modified after this time (in ISO-8601 format). agent (:obj:`str`, optional): Return snippets initiated by this agent. before_time (:obj:`str`, optional): Only return snippets modified before this time (in ISO-8601 format). catalog_number (:obj:`str`, optional): List snippets for occurrence records with this catalog number. collection (:obj:`str`, optional): List snippets for this collection. ident1 (:obj:`str`, optional): List snippets with this primary object identifier. ident2 (:obj:`str`, optional): List snippets with this secondary object identifier. operation (:obj:`str`, optional): List snippets for this operation. provider (:obj:`str`, optional): List snippets for this occurrence point provider. url (:obj:`str`, optional): List snippets related to this URL. who (:obj:`str`, optional): List snippets created by this entity. why (:obj:`str`, optional): List snippets that were created for this reason. Returns: list of dict: A list of JSON dictionaries for matching snippets. """ return RestService.list(self, self.end_point, after_time=after_time, agent=agent, before_time=before_time, catalog_number=catalog_number, collection=collection, ident1=ident1, ident2=ident2, operation=operation, provider=provider, url=url, who=who, why=why)
def delete_tree(self, gridset_id): """Attempts to delete a gridset's tree. Args: gridset_id (int): The identifier of the tree to delete. Returns: HTTP Response: An indication from the server if the delete was successful. """ return RestService.delete( self, '{}/{}/tree'.format(self.end_point, gridset_id))
def delete(self, tree_id): """Attempts to delete the tree specified by tree_id. Args: tree_id (int): The identifier of the tree to delete. Returns: HTTP Response: Indication of deletion success. """ return RestService.delete(self, '{}/{}'.format(self.end_point, tree_id))
def delete(self, shapegrid_id): """Attempts to delete a shapegrid. Args: shapegrid_id (int): The database identifier of the shapegrid to delete. Returns: HTTP Response: HTTP status indicating success. """ return RestService.delete(self, '{}/{}'.format(self.end_point, shapegrid_id))
def delete(self, sdmproject_id): """Attempts to delete a projection. Args: sdmproject_id (int): The identifier of the projection to delete. Returns: HTTP Response: An HTTP response indicating success. """ return RestService.delete( self, '{}/{}'.format(self.end_point, sdmproject_id))
def delete(self, scenario_id): """Attempts to delete a scenario. Args: scenario_id (int): The identifier of the scenario to delete. Returns: HTTP Response: An HTTP status message indicating success. """ return RestService.delete(self, '{}/{}'.format(self.end_point, scenario_id))
def delete(self, gridset_id): """Attempts to delete a gridset. Args: gridset_id (int): The identifier for the gridset to delete. Returns: HTTP Response: Confirmation or failure response associated with the delete request. """ return RestService.delete(self, '{}/{}'.format(self.end_point, gridset_id))
def delete(self, occurrence_id): """Attempts to delete the occurrence set specified by occurrence_id. Args: occurrence_id (int): The identifier of the occurrence set to delete. Returns: HTTP Response: A response from the server with the HTTP status indicating success of the delete request. """ return RestService.delete( self, '{}/{}'.format(self.end_point, occurrence_id))
def post(self, scenario_json): """Post a new scenario to the server. Args: scenario_json (dict): A JSON dictionary of scenario metadata. Returns: dict: A JSON dictionary of scenario metadata. """ return RestService.post(self, self.end_point, body=scenario_json, headers={'Content-Type': 'application/json'})
def post(self, taxon_ids): """Get points for the provided taxon identifiers. Args: taxon_ids (list): A list of taxonomic identifiers to get points for. Returns: dict: A dictionary (JSON) of metadata about the points request. """ return RestService.post(self, self.end_point, body=json.dumps(taxon_ids), headers={'Content-Type': 'application/json'})
def post(self, taxon_ids): """Submit a POST request to the Open Tree endpoint to get a tree from ids. Args: taxon_ids (list): A list of taxonomic identifiers established by GBIF. Returns: dict: A JSON dictionary of Open Tree response data. """ return RestService.post(self, self.end_point, body=json.dumps(taxon_ids), headers={'Content-Type': 'application/json'})
def post(self, boom_post_json): """POST a new gridset creation request. Args: boom_post_json (dict): A JSON dictionary of gridset parameters. Returns: HTTP Response: A success indication as an HTTP response status. """ return RestService.post(self, self.end_point, body=json.dumps(boom_post_json), headers={'Content-Type': 'application/json'})
def get(self, gridset_id, interface=None): """Attempts to get a gridset. Args: gridset_id (int): The identifier of the gridset to retrieve. interface (str): The format interface the gridset should be returned as. Returns: xml string: Returned if the interface is 'xml' dict: A JSON dictionary of gridset metadata. """ return RestService.get(self, '{}/{}'.format(self.end_point, gridset_id), interface=interface)
def count(self, after_status=None, after_time=None, algorithm_code=None, before_status=None, before_time=None, display_name=None, epsg_code=None, model_scenario_code=None, occurrence_set_id=None, projection_scenario_code=None, scenario_id=None, status=None, gridset_id=None): """Counts projections matching the provided criteria. Args: after_status (int): Count projections with a status greater than this. after_time (str): Count projections modified after this time. algorithm_code (str): Count projections built with this algorithm. before_status (int): Count projections with a status less than this. before_time (str): Count projections modified before this time. display_name (str): Count projections with this display name. epsg_code (int): Count projections using this map projection. model_scenario_code (str): Count projections built from this model. occurrence_set_id (int): Count projections built from this occurrence set. projection_scenario_code (str): Count projections using this scenario. scenario_id (int): Count projections using this scenario identifier. status (int): Count projections with this exact status. gridset_id (int): Count projections in this gridset. Returns: int: The number of projections matching the criteria. """ return RestService.count( self, '{}/count'.format(self.end_point), after_status=after_status, after_time=after_time, algorithm_code=algorithm_code, before_status=before_status, before_time=before_time, display_name=display_name, epsg_code=epsg_code, model_scenario_code=model_scenario_code, occurrence_set_id=occurrence_set_id, projection_scenario_code=projection_scenario_code, scenario_id=scenario_id, status=status, gridset_id=gridset_id)
def post(self, boom_post_json): """Post a new experiment. Args: boom_post_json (dict): A dictionary of BOOM parameters for submitting an experiment. Returns: HTTP Response: An indication of success of the experiment post. """ return RestService.post(self, self.end_point, body=boom_post_json, headers={'Content-Type': 'application/json'})
def post(self, names_list): """Submit a request to get accepted names from a provided list of names. Args: names_list (list of str): A list of names to get the GBIF accepted names for, if they are available. Returns: dict: A dictionary (JSON) of name translation information. """ return RestService.post(self, self.end_point, body=json.dumps(names_list), headers={'Content-Type': 'application/json'})
def get(self, scenario_id, interface=None): """Attempts to get a scenario. Args: scenario_id (int): The identifier of the scenario to retrieve. interface (str): The format to return the scenario in. Returns: str: XML metadata for the scenario. dict: JSON dictionary of scenario metadata. """ return RestService.get(self, '{}/{}'.format(self.end_point, scenario_id), interface=interface)
def list(self, after_time=None, before_time=None, has_branch_lengths=None, is_binary=None, is_ultrametric=None, limit=None, meta_string=None, name=None, offset=None, user=None): """Lists occurrence sets matching the provided criteria. Args: after_time (:obj:`str`, optional): Only trees modified after this time (in ISO-8601 format). before_time (:obj:`str`, optional): Only return trees modified before this time (in ISO-8601 format). has_branch_lengths (:obj:`bool`, optional): Return trees that have or do not have branch lengths. is_binary (:obj:`bool`, optional): Return trees that are or are not binary. is_ultrametric (:obj:`bool`, optional): Return trees that are or are not ultrametric. limit (:obj:`int`, optional): Return up to this number of trees. meta_string (:obj:`str`, optional): Return trees with this metadata string attached to them. name (:obj:`str`, optional): Return trees that have this name. offset (:obj:`int`, optional): Offset the list of returned trees by this number. user (:obj:`str`, optional): If 'public', return public trees. If 'anon', return anonymous trees. If None, return the user's trees. Returns: list of dict: A list of tree metadata JSON dictionaries. """ return RestService.list(self, self.end_point, after_time=after_time, before_time=before_time, has_branch_lengths=has_branch_lengths, is_binary=is_binary, is_ultrametric=is_ultrametric, limit=limit, meta_string=meta_string, name=name, offset=offset, user=user)
def count(self, after_status=None, after_time=None, before_status=None, before_time=None, display_name=None, epsg_code=None, gridset_id=None, minimum_number_of_points=None, squid=None, status=None, user=None): """Counts the number of occurrence sets matching the provided criteria. Args: after_status (:obj:`int`, optional): Only return occurrence sets that have a status value greater than this number. after_time (:obj:`str`, optional): Only return occurrence sets modified after this time (in ISO-8601 format). before_status (:obj:`int`, optional): Only return occurrence sets that have a status value less than this number. before_time (:obj:`str`, optional): Only return occurrence sets modified before this time (in ISO-8601 format). display_name (:obj:`str`, optional): Only return occurrence sets that have this display name. epsg_code (:obj:`int`, optional): Only return occurrence sets that have this EPSG code. gridset_id (:obj:`int`, optional): Only return occurrence sets that are part of the gridset with this ID. minimum_number_of_points (:obj:`int`, optional): Only return occurrence sets that have at least this many points. squid (:obj:`str`, optional): Only return occurrence sets that have this squid (hash value for species identifier). status (:obj:`int`, optional): Only return occurrence sets that have this status. user (:obj:`str`, optional): If 'public', return public occurrence sets. If 'anon', return anonymous occurrence sets. If None, return the user's occurrence sets. Returns: int: The number of matching occurrence set records. """ return RestService.count( self, '{}/count'.format(self.end_point), after_status=after_status, after_time=after_time, before_status=before_status, before_time=before_time, display_name=display_name, epsg_code=epsg_code, gridset_id=gridset_id, minimum_number_of_points=minimum_number_of_points, squid=squid, status=status, user=user )
def list(self, search_string, limit=None): """Gets a list of specie hint matches. Args: search_string (str): A partial string to match species names against. limit (int): The maximum number of results to return. Returns: list of strings: List of matching species. """ return RestService.list( self, '{}/{}'.format(self.end_point, search_string), limit=limit )