Project

General

Profile

« Previous | Next » 

Revision 12650

validation/aggregating/plots/bien3_validations_salvias_vegbien.sql: updated to DB

View differences:

trunk/validation/aggregating/plots/bien3_validations_salvias_vegbien.sql
261 261
Note: Must do equivalent concatenation of taxonomic field in source db.
262 262
*/
263 263

  
264
-- ------------------
265
-- 16. Intercept values for each (verbatim) taxon in each plot in each project
266
--      where line-intercept values are recorded
267
-- 
268
-- Note 1: Assumes identical concatenation of taxonomic fields
269
--       to form verbatim taxon name in origina db
270
-- Note 2: Grouping mean cover for entire plot combines plots with
271
--       subplots (separate cover measure for each species in each subplot) with 
272
--       plots with strata (separate cover measures for each species in each 
273
--       stratum) with plots without subplots or strata (one cover measure 
274
--       per species per plot.
275
-- ------------------
276 264
-- _plots_16_intercepts_for_each_verb_taxon_in_each_plot_in_each_project
265
 SELECT DISTINCT p.projectname AS project_name, 
266
    l.authorlocationcode AS plot_code, 
267
    btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text))) AS taxon, 
268
    sum(ao.linecover_m) AS intercept_cm
269
   FROM ((((((((public.project p
270
   JOIN public.source s ON ((p.source_id = s.source_id)))
271
   JOIN public.locationevent le ON ((p.project_id = le.project_id)))
272
   JOIN public.locationevent sub_locationevent ON ((sub_locationevent.parent_id = le.locationevent_id)))
273
   JOIN public.plot l ON ((le.location_id = l.plot_id)))
274
   JOIN public.taxonoccurrence o ON ((sub_locationevent.locationevent_id = o.locationevent_id)))
275
   JOIN public.taxondetermination td ON ((td.taxonoccurrence_id = o.taxonoccurrence_id)))
276
   JOIN public.taxonverbatim tv ON ((td.taxonverbatim_id = tv.taxonverbatim_id)))
277
   JOIN public.aggregateoccurrence ao ON ((o.taxonoccurrence_id = ao.taxonoccurrence_id)))
278
  WHERE (((s.shortname = :datasource::text) AND (td.isoriginal = true)) AND (ao.linecover_m IS NOT NULL))
279
  GROUP BY p.projectname, l.authorlocationcode, btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)))
280
  ORDER BY p.projectname, l.authorlocationcode, btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)));
281
/*
282
Note 1: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in origina db
283
Note 2: Grouping mean cover for entire plot combines plots with subplots (separate cover measure for each species in each subplot) with  plots with strata (separate cover measures for each species in each  stratum) with plots without subplots or strata (one cover measure  per species per plot.
284
*/
277 285

  
278 286
-- _plots_17_count_of_subplots_per_plot_for_each_project
279 287
 SELECT p.projectname AS project_name, 

Also available in: Unified diff