Using species_count for ranks higher than species

I’m working on a fun little python script to make Bar Charts for specific taxa like eBird has. I think this is useful because I’m quite interested in knowing what to look for in places before I go there. Like, before I go unfamiliar places, I usually spend a week just surfing eBird to know what to look for, and that’s harder to do for iNat. Anyway, I’m sure such an app already exists and is way better than mine and I don’t really care because I am enjoying learning about how to do this (I’m a biologist, not a computer scientist!)

One thing I want is to be able to see the most common genera or families instead of species. For insects, for example, it’s unlikely I’ll ever be able to ID something to species in the field, but I could def ID to a higher rank. I’m using species_counts from the API, for the most part, and the thing is, if I ask for a rank higher than species, it only gets the observations that are not ID’d to a lower rank. For example, if you look for common spider families in Canada, you get that there are way more running crab spiders and cobweb spiders than jumping spiders. This is definitely not true, as you can find on the explore page, the issue is that it’s way more likely that people ID jumping spiders to genus or species than it is for other families. Why does it work like this? Is there a way around this? Certainly if we know the species, we know the family/order/etc.

https://forum.inaturalist.org/t/seasonality-of-species-for-location/66082/5

This is very cool. How does it load so fast? My main frustration with mine is that it takes like a minute minimum because of the API rate limit

look at what the page notes as the base query. you could get data as a series of 12 months or maybe even 53 weeks to make a time series.

but if you have fewer taxa than time periods, it would be faster to use the histogram endpoint.

As far as helping you - What you do when you export is make sure that taxon fields are checked off on export (so that your code can properly read the CSV data) before you download an export you want to make sure to check off all the boxes for taxon fields (Kindom, order, family, phylum, class, genera, species) - that way the code will interpret it properly. If you do not, it will parse incorrectly and come up as “unknown” EVEN if you have 4 of the 5. Now you could write more code that would otherwise create a fallback for that - basically (if taxon kingdom or Order ID did not get recorded then it would fall back on genus and you could code that genus to be tied to X order and X kingdom).

Hi there, you can utilize my free web app for this.

Find your site, create a bounding box for it in the map and hit download to export a CSV. Take that CSV and upload it onto the App. Then head to the map tab and you can Check off the taxon you would like to view. Once checked off you can sort by taxon level. Once sorted you can click on a point and view the observation on the map (it shows observation pic and gives an Inat link). If you have any trouble with it you can click “how to use” button on the right side of the screen in the app.

You can sort by all taxons, by year utilizing the main menu sidebar. You can even see how a single genera has been observed across the map and where the most frequent sightings are for that year.

https://stratified.william-dawson0526.workers.dev/

are you sure about this? look at the example use case mentioned in the original post – spiders in Canada, of which there are >400000 observations. your thing requires observations in a CSV as the input, but iNaturalist won’t generate a CSV export with more than 200000 records.

Okay, this answer was quite helpful in developing that website! I now use the histograms and it is way faster.

But it doesn’t quite answer my original question. Like, to know which genera/families/whatever to load histograms for, I need to use species_counts. But it doesn’t work right if you’ve ID’d the observation to species. For example you can look for insects right now on my website and see that it works perfectly if you ask for species, but it gives some strange results if you try to look by family. Where I am in Maryland, it doesn’t even list Apidae. And the reason is that Apidae is result #56 in species_counts, and I could never search down that far (it would take a whole minute).

as noted in my previous post, you should use histogram only in cases where you have fewer taxa than time intervals. otherwise, you should use the endpoint that my page uses, since that endpoint can get all taxa in one request.

you can make a call to that endpoint first, and then depending on how many taxa are returned, you can either:

  • get a series of the same information, for various time interval slices (ex. 12 requests for 12 months, or 53 request for 53 weeks), OR
  • get a series of histograms, for various taxa (1 request per taxon)

Ah awesome, I see what you mean. I think it works quite well now. Thank you!

great. this might help some folks who wanted something like this for non-bird taxa.