Commit 4c03e623 authored by Matija Obreza's avatar Matija Obreza
Browse files

Display accessions with similar climatic parameters

parent 0800bfef
......@@ -41,6 +41,7 @@ import Authorize from 'ui/common/authorized/Authorize';
import TemperatureChart from './c/TemperatureChart';
import PrecipitationChart from './c/PrecipitationChart';
import ClimateTable from './c/ClimateTable';
import ActionButton from 'ui/common/buttons/ActionButton';
const styles = (theme) => ({
pageSection: {
......@@ -124,6 +125,65 @@ class BrowsePage extends React.Component<IBrowsePageProps, any> {
applyFilters(filter);
}
private makeRange = (variable: number, diff: number) => {
return {
ge: Math.round(variable - diff),
le: Math.round(variable + diff),
};
}
private applyClimateFilters = () => {
const { accession: {details: accession}, applyFilters } = this.props;
// BIO1 = Annual Mean Temperature !!
// BIO2 = Mean Diurnal Range (Mean of monthly (max temp - min temp))
// BIO3 = Isothermality (BIO2/BIO7) (* 100)
// BIO4 = Temperature Seasonality (standard deviation *100)
// BIO5 = Max Temperature of Warmest Month
// BIO6 = Min Temperature of Coldest Month
// BIO7 = Temperature Annual Range (BIO5-BIO6)
// BIO8 = Mean Temperature of Wettest Quarter
// BIO9 = Mean Temperature of Driest Quarter
// BIO10 = Mean Temperature of Warmest Quarter
// BIO11 = Mean Temperature of Coldest Quarter
// BIO12 = Annual Precipitation
// BIO13 = Precipitation of Wettest Month
// BIO14 = Precipitation of Driest Month
// BIO15 = Precipitation Seasonality (Coefficient of Variation)
// BIO16 = Precipitation of Wettest Quarter
// BIO17 = Precipitation of Driest Quarter
// BIO18 = Precipitation of Warmest Quarter !!
// BIO19 = Precipitation of Coldest Quarter !!
const tempDiff = 2;
const filter = {
taxa: {
genus: [ accession.taxonomy.genus ],
// species: [ accession.taxonomy.species ],
},
geo: {
climate: {
// temperature
bio1: this.makeRange(accession.geo.climate.bio1, tempDiff),
// bio2: this.makeRange(accession.geo.climate.bio2, tempDiff),
bio4: this.makeRange(accession.geo.climate.bio4, accession.geo.climate.bio4 * .50),
// bio7: this.makeRange(accession.geo.climate.bio7, tempDiff),
// bio8: this.makeRange(accession.geo.climate.bio8, tempDiff),
// bio9: this.makeRange(accession.geo.climate.bio9, tempDiff),
// bio10: this.makeRange(accession.geo.climate.bio10, tempDiff),
// bio11: this.makeRange(accession.geo.climate.bio11, tempDiff),
// precipitation
bio12: this.makeRange(accession.geo.climate.bio12, accession.geo.climate.bio12 * .25),
// bio13: this.makeRange(accession.geo.climate.bio13, precDif),
// bio14: this.makeRange(accession.geo.climate.bio14, precDif),
// bio15: this.makeRange(accession.geo.climate.bio15, accession.geo.climate.bio15 * .25),
bio18: this.makeRange(accession.geo.climate.bio18, accession.geo.climate.bio18 * .25),
bio19: this.makeRange(accession.geo.climate.bio19, accession.geo.climate.bio19 * .25),
},
},
};
applyFilters(filter);
}
public render() {
const { t, error, uuid, doi, accessions, auditLog, classes } = this.props;
......@@ -355,6 +415,9 @@ class BrowsePage extends React.Component<IBrowsePageProps, any> {
</PropertiesItem>
)) }
</Properties>
<div>
<ActionButton action={ this.applyClimateFilters } title="View accessions with similar climate" />
</div>
</PageSection>
}
......
......@@ -22,6 +22,10 @@ class TileClimate {
public bio13: number;
public bio14: number;
public bio15: number;
public bio16: number;
public bio17: number;
public bio18: number;
public bio19: number;
public prec1: number;
public prec2: number;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment