Skip to content

Commit

Permalink
adjust rank_level cutoff for aggregated results; fix location parsing…
Browse files Browse the repository at this point in the history
… issue
  • Loading branch information
pleary committed Feb 9, 2024
1 parent c4a946f commit b60dbb5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/inat_vision_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def best_leaves_from_aggregated_results(self, aggregated_results, iteration=0):
# set a rank level cutoff on higher taxa to include in results
if iteration > 0:
remaining_results = remaining_results.query(
"rank_level <= 30"
"rank_level < 50"
)
# after setting a cutoff, get the parent IDs of the remaining taxa
parent_taxon_ids = remaining_results["parent_taxon_id"].values # noqa: F841
Expand Down Expand Up @@ -290,7 +290,10 @@ def download_observation(self, observation_id, image_uuid):
if not os.path.exists(cache_path):
urllib.request.urlretrieve(
data["results"][0]["photos"][0]["url"].replace("square", "medium"), cache_path)
latlng = data["results"][0]["location"].split(",")
if data["results"][0]["location"] is None:
latlng = [None, None]
else:
latlng = data["results"][0]["location"].split(",")
# return the path to the cached image, coordinates, and iconic taxon
return cache_path, latlng[0], latlng[1], data["results"][0]["taxon"]["iconic_taxon_id"]

Expand Down

0 comments on commit b60dbb5

Please sign in to comment.