lifewatch / sdmpredictors

A compilation of environmental data for species distribution modelling
http://lifewatch.github.io/sdmpredictors/
Other
30 stars 6 forks source link

include variance term, eg standard deviation #3

Closed bbest closed 6 years ago

bbest commented 6 years ago

Hi @samuelbosch,

Would be great to see a variance term for these layers, such as sd(). This came up as a need while helping a master's group project working on ocean acidification (eg gapanalysis.R).

samuelbosch commented 6 years ago

I have these for each raster in sdmpredictors. This is offcourse only for the full raster.

sdmpredictors::layer_stats("BO_sstmean")
    layer_code minimum     q1 median     q3 maximum      mad     mean       sd     moran        geary
967 BO_sstmean  -1.801 10.489 22.046 27.093  32.918 8.880774 18.51915 9.956991 0.9918086 3.470476e-05

Is this enough?

samuelbosch commented 6 years ago

Oh and here is the xylookup service: https://github.com/iobis/xylookup

bbest commented 6 years ago

sdmpredictors has variance, yay!

Ah, sweet! I didn't see sdmpredictors::layer_stats("BO_sstmean"). Yes, that's plenty! Please check this out @raetaylorburns.

xylookup gives env for point, yay!

Tried API at http://api.iobis.org/xylookup?x=-124.5387797&y=47.4966316 and get JSON:

[{
  "shoredistance": 14351.0, 
  "grids": {
    "sstemperature": 11.282506942749023, 
    "sssalinity": 29.75642967224121, 
    "bathymetry": 38.0}, 
  "areas": {
    "final_grid5": [{
      "country": "United States", 
      "base": "T", 
      "type": "eez", 
      "name": "United States: North Pacific", 
      "sp_id": "245"}, 
       {"country": "United States", 
      "base": "F", 
      "type": "eez", 
      "name": "United States: all", 
      "sp_id": "United States: all"}]}}]

or in R:

devtools::install_github('iobis/obistools')
library(obistools)
lookup_xy(data.frame(decimalLongitude=-124.5387797, decimalLatitude=47.4966316), areas=T)
  shoredistance sstemperature sssalinity bathymetry
1         14353       11.2825    29.7564         38
                                                                                                              final_grid5
1 United States, United States, T, F, eez, eez, United States: North Pacific, United States: all, 245, United States: all

Would be great to see more sdmpredictors in this service, and expand to summary stats for mregions: EEZs, LMEs, EBSAs, WDPAs, etc.

Well done!

raetaylorburns commented 6 years ago

Hi @samuelbosch! As far as I can tell, the standard deviation here is a single value for the whole raster... is that correct? I am looking for a raster of standard deviation values for each sst for cell but I am not sure if its possible or how how to access this via smdpredictors? Am I missing something? Thank you for your help! Rae

samuelbosch commented 6 years ago

Hi Rae,

sdmpredictors only makes the data available without creating it. Bio-ORACLE only has mean values for SST but MARSPEC has the variance, so you could transform those to standard deviations. For SST:

x <- sdmpredictors::load_layers('MS_biogeo17_sst_variance_5m')
sststdev <- sqrt(x)
raetaylorburns commented 6 years ago

Oooh great thank you! Thats exactly what I was looking for.

raetaylorburns commented 6 years ago

One more note - I am also looking for the variance or standard deviation of dissolved oxygen... I do not see this available on MARSPEC but once again I am not sure if I am missing something or looking in the wrong place. Thank you so much for your help!

samuelbosch commented 6 years ago

I'm not aware of such data. I'll ask Jorge Assis (main author of Bio-ORACLE 2) if it is doable to create it.

samuelbosch commented 6 years ago

Just got an answer, the raw data was discarded after calculating the mean/min/max so the standard deviation can't be quickly produced. If the data is ever re-generated we'll also include standard deviations.

raetaylorburns commented 6 years ago

Ok great thank you so much for all your help!