Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: updates to the webpages #17

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ilamb3/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ def make_comparable(
# ensure longitudes are uniform
ref, com = adjust_lon(ref, com)

# ensure the lat/lon dims are sorted
if dset.is_spatial(ref):
ref = ref.sortby([dset.get_dim_name(ref, "lat"), dset.get_dim_name(ref, "lon")])
if dset.is_spatial(com):
com = com.sortby([dset.get_dim_name(com, "lat"), dset.get_dim_name(com, "lon")])

# pick just the sites
if dset.is_site(ref[varname]):
com = extract_sites(ref, com, varname)
Expand Down
15 changes: 15 additions & 0 deletions ilamb3/templates/dataset_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@
var RNAME = rsel.options[rsel.selectedIndex].value;
var msel = document.getElementById("SelectModel");
var MNAME = msel.options[msel.selectedIndex].value;
var psel = document.getElementById("SelectPlot");
var PNAME = psel.options[psel.selectedIndex].value;
{% for aname,analysis in analyses.items() -%}
{% for pname,plot in analysis.items() -%}
{% for item in plot -%}
Expand All @@ -101,6 +103,15 @@
{% endfor -%}
{% endfor -%}
{% endfor %}
var model_names = {{model_names}};
var ref_plots = {{ref_plots}};
if (ref_plots.includes(PNAME)) {
model_names.unshift("Reference");
document.getElementById("divReference").style.opacity = 100;
}else{
document.getElementById("divReference").style.opacity = 0;
}
model_names.forEach((x, i) => document.getElementById("div" + x).src = x + "_" + RNAME + "_" + PNAME + ".png");
};
function formatterValue(cell, formatterParams, onRendered) {
if (isNaN(Number.parseFloat(cell.getValue()))) {
Expand Down Expand Up @@ -137,6 +148,10 @@
});
table.on("rowClick", function (e, row) {
var rowData = row.getData();
if (rowData["source"] != "Reference") {
document.getElementById('SelectModel').value = rowData["source"];
updateImages();
}
var cells = row.getCells();
cells.forEach(function (cell, i) {
for (const c of cell.getColumn().getCells()) {
Expand Down