Closed Tasilee closed 1 year ago
@adam-collins GET http://devt.ala.org.au:8087/spApp/DoubleGriddingContent.htm 404 DoubleGriddingContent.htm is not committed into git yet
@adam-collins By choosing "Streptopelia", and "Australia" area, Double grids tool works However, if we select area "World", it produces empty records
Found one possible reason: https://github.com/AtlasOfLivingAustralia/spatial-service/blob/master/src/main/groovy/au/org/ala/spatial/analysis/layers/DoubleGriddingGenerator.java#L156
When we select "world" as area, bbox of regions is -180, -90 -- 180, 90 region.isWithin_EPSG900913(112.45, -43 ) return false
However, if we choose Australia area -- bbox 112,-4 : 115,-9, it returns true
I have added a test for this case: https://github.com/AtlasOfLivingAustralia/spatial-service/blob/49_double_grid/src/test/groovy/au/org/ala/spatial/util/SimpleRegionSpec.groovy
Set bbox latitude to 90/-90 will fail the test
if we define a region: SimpleShapeFile.parseWKT("POLYGON((-180 -89,180 -89,180 89,-180 89,-180 -89))"); succeed on checking : assertTrue(region.isWithin_EPSG900913(112.45, -43))
but a region defined asSimpleShapeFile.parseWKT("POLYGON((-180 -90,180 -90,180 90,-180 90,-180 -90))"), assertTrue(region.isWithin_EPSG900913(112.45, -43)) will fail
Dig deeper, we can see:
SpatialUtil.convertLatToPixel( -90) = -1 SpatialUtil.convertLatToPixel( -89) = 673563127
Deeper: in method: convertLatToPixel(double lat) Math.log((1.0D + Math.sin(lat 3.141592653589793D / 180.0D)) / (1.0D - Math.sin(lat 3.141592653589793D / 180.0D)))
When lat = -90 or 90, Math.log returns infinity
@adam-collins points out we need to use 179.9999 89.9999 We modified the boundary of world in application.yml of Spatial Hub
With this type of tool, we probably need to limit the area to far less than global, given our mandate. Running it on Australia (~8 million sq.km) would make sense and Southern Ocean (similar size) likewise. We leave the larger areas to GBIF.
@Tasilee I created a new ticket for this improvement. https://github.com/AtlasOfLivingAustralia/spatial-hub/issues/367
Donald Hobern demonstrated some GBIF scripts that may prove handy for comparing aggregated data across the three dimensions of name, space and time. Certainly relevant to EBVs and SoE. It goes like this
Supply a taxa (usually a genus or higher)
Supply a primary grid size (e.g., 0.1 degree or 10km)
Supply s secondary grid size (e.g., 1 degree or 100km)
Supply a temporal bin range (e.g., 10 years)
Generate a points to grid using the primary grid size on the taxa
Calculate the new layers at the secondary grid size for each time slice a. Number of non-null primary grid cells (bins) b. Number of species in bins c. Number of occurrences in bins d. For each species present: Number of occurrences for species x in bins
An example of the type of data produced-
The double gridding removes much of the point-sampling bias and aggregates the data to a level where comparisons across name, space and time should be useful.