inbo / natuurindicatoren

🌳 Calculation of the nature indicators for Flanders
MIT License
0 stars 0 forks source link

Rosse stekelstaart indicatoren update post 2019 #18

Closed SanderDevisscher closed 4 years ago

SanderDevisscher commented 5 years ago

Zie mail van 2019-08-19 "Cube watervogeldatabank aanspreken via R?".

Indien het rechtstreeks aanspreken van de watervogeldatabank tot de opties behoord dienen de scripts nog aangepast te worden aan deze bronnen.

SanderDevisscher commented 5 years ago
> USE [W0004_00_Waterbirds]
> 
> ;with BASISDATA as (
> SELECT T.commonname
>   , L.LocationWVNaam
>   , L.LocationGeometry.STCentroid().STX as CentroidX
>   , L.LocationGeometry.STCentroid().STY as CentroidY
>   , S.Seasonname
>   , D.Date
>   , D.Year
>   , D.Month
>   , fct.TaxonCount
>   , P.PersonNaam
> FROM FactTaxonOccurrence fct
>   INNER JOIN DimTaxonWV T ON T.TaxonWVKey = fct.TaxonWVKey
>   INNER JOIN DimPerson P ON P.PersonKey = fct.PersonKey
>   INNER JOIN DimSample SA ON SA.SampleKey = fct.SampleKey
>   INNER JOIN DimSeason S on S.SeasonKey = fct.SeasonKey
>   INNER JOIN DimDate D on D.DateKey = SA.SampleDateKey
>   INNER JOIN DimLocationWV L on L.LocationWVKey = fct.LocationWVKey
> WHERE 1=1
>   AND T.commonname = 'Rosse Stekelstaart'
>   AND fct.TaxonCount > 0
>   AND SA.samplestatus not in ('REJECTED')
> )
> ,
> GEBIEDSMAXPERMAAND as (
> SELECT Seasonname
>   , Month
>   , LocationWVNaam
>   , max(TaxonCount) as Count
> FROM BASISDATA
> GROUP BY Seasonname, Month, LocationWVNaam
> )
> 
> SELECT seasonname AS winter
>   , MAX(tmp.sumcount) AS wintermax
> FROM (SELECT seasonname, Month, sum(count) AS Sumcount 
>       FROM GEBIEDSMAXPERMAAND
>       GROUP BY seasonname, month)tmp
> GROUP BY tmp.seasonname
> ORDER BY tmp.seasonname
SanderDevisscher commented 5 years ago

Voor herschrijven van recorder inputs: INBO-SQL07-PRD/D0017_00_NBNData

SanderDevisscher commented 4 years ago

next step is de verschillende RMD die gebaseerd zijn op recorder data herschrijven zodat ze zonder manuele handelingen data van recorder kunnen halen.