Skip to content

Commit

Permalink
Merge pull request #1384 from aodn/compute_total_inverts_after_binning
Browse files Browse the repository at this point in the history
sum observation and biomass after binning
  • Loading branch information
utas-raymondng authored Dec 19, 2024
2 parents 77b0b1e + 2407a20 commit 61c34cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public void verifyEpM2Inverts() {
repository.refreshEpM2Inverts();

List<Tuple> l = repository.getEpM2Inverts(0, 100);
assertEquals(9, l.size(), "Size match");
assertEquals(7, l.size(), "Size match");

List<Tuple> t1 = l.stream()
.filter(i -> i.get("reporting_name") != null)
Expand All @@ -162,22 +162,12 @@ public void verifyEpM2Inverts() {
List<Tuple> t2 = l.stream()
.filter(i -> i.get("reporting_name") != null)
.filter(i -> "Centrostephanus rodgersii".equals(i.get("reporting_name").toString())).collect(Collectors.toList());
assertEquals(3, t2.size(), "t2 size match");
assertEquals(1, t2.size(), "t2 size match");

assertEquals(2, t2.get(0).get("method"), "t2 0 method match");
assertEquals(1, t2.get(0).get("block"), "t2 0 block match");
assertEquals(BigDecimal.valueOf(10), t2.get(0).get("size_class"), "t2 0 size_class match");
assertEquals(BigInteger.valueOf(1), t2.get(0).get("total"), "t2 0 total match");

assertEquals(2, t2.get(1).get("method"), "t2 1 method match");
assertEquals(1, t2.get(1).get("block"), "t2 1 block match");
assertEquals(BigDecimal.valueOf(10), t2.get(1).get("size_class"), "t2 1 size_class match");
assertEquals(BigInteger.valueOf(4), t2.get(1).get("total"), "t2 1 total match");

assertEquals(2, t2.get(2).get("method"), "t2 2 method match");
assertEquals(1, t2.get(2).get("block"), "t2 2 block match");
assertEquals(BigDecimal.valueOf(10), t2.get(2).get("size_class"), "t2 2 size_class match");
assertEquals(BigInteger.valueOf(8), t2.get(2).get("total"), "t2 2 total match");
assertEquals(BigInteger.valueOf(13), t2.get(0).get("total"), "t2 0 total match");

List<Tuple> t3 = l.stream()
.filter(i -> i.get("reporting_name") != null)
Expand Down
9 changes: 6 additions & 3 deletions db/endpoints/CreatePrivateEndpoints.sql
Original file line number Diff line number Diff line change
Expand Up @@ -841,10 +841,13 @@ species_name,
taxon,
reporting_name,
bfc.nominal size_class,
total,
biomass
sum(total)::bigint as total,
sum(biomass) as biomass
from invert_sized m2
inner join bounded_fish_classes bfc on m2.size_class > bfc.lower_bound and m2.size_class <= bfc.upper_bound;
inner join bounded_fish_classes bfc on m2.size_class > bfc.lower_bound and m2.size_class <= bfc.upper_bound
group by survey_id,country,area,ecoregion,realm,location,site_code,site_name,latitude,longitude,survey_date,depth,geom,
program,visibility,hour,survey_latitude,survey_longitude,diver,"method",block,phylum,"class","order",family,
recorded_species_name,species_name,taxon,reporting_name,bfc.nominal;

/* Endpoint "M12 Debris" #172 */
CREATE OR REPLACE VIEW nrmn.ep_m12_debris AS
Expand Down

0 comments on commit 61c34cf

Please sign in to comment.