Skip to content

Commit

Permalink
Merge pull request #31 from cioos-siooc/add_match_taxa
Browse files Browse the repository at this point in the history
add match_taxa wrap, fix env.yml
  • Loading branch information
jdpye authored Nov 24, 2023
2 parents b5951a1 + f1c20ec commit 678e169
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ dependencies:
- geopandas
- pyworms
- ckanapi
- httpx
- plotly
- async
- requests
Expand Down
17 changes: 17 additions & 0 deletions pyobistools/taxa.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

from pyobistools.utils import removesuffix

from pyobistools.validation import check_scientificname_and_ids as check_names


STANDARD_SPECIES_COLUMNS = {
'taxon_id': np.nan,
'url': '',
Expand Down Expand Up @@ -94,6 +97,20 @@ def add_suffix(name: str) -> t.List[str]:
return [name.strip() + s for s in suffixes]


def match_taxa(names, ask=True, itis_usage=False):
"""
Wrap the existing functionality in validation in the expected name for this function as per R's iobis/obistools.
@param names List of scientific names to check against
@param ask Do we ask the user to resolve multi-match or ambiguous names?
@param itis_usage Pass through the ITIS check setting for the client function to handle
@return structure with appended lsids where WoRMS (or ITIS can resolve them)
"""

return check_names.check_scientificname_and_ids(names, value='names', itis_usage=itis_usage)


def search_worms(names: t.List[str],
kwargs: t.Dict[str, t.Any] = {}) -> pd.DataFrame:
"""
Expand Down

0 comments on commit 678e169

Please sign in to comment.