Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
sirmmo committed Nov 7, 2024
1 parent 11d9353 commit 8e18920
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/app/components/DownloadDataDialog/mapDlData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ const MapDlData = (props: MapDlDataProps) => {
const activeConfiguration: any = useRef({
...configuration,
});
const previousConfiguration: any = useRef({
...configuration,
});

const [activeCombination, setActiveCombination] = React.useState<any>(
combinations[configuration.climatological_variable],
Expand Down Expand Up @@ -192,6 +195,7 @@ const MapDlData = (props: MapDlDataProps) => {
};

const handleChange = (field, value) => {
previousConfiguration.current = { ...activeConfiguration.current };
if (field === 'climatological_variable') {
setActiveCombination(combinations[value]);
const conf = toDefault(combinations[value]);
Expand All @@ -203,9 +207,25 @@ const MapDlData = (props: MapDlDataProps) => {
setActive(activeConfiguration.current);
}

api.getForecastData(activeConfiguration).then(x => {
console.log('found netcdf', x);
});
api
.getLayer(
activeConfiguration.current.climatological_variable,
activeConfiguration.current.climatological_model,
activeConfiguration.current.scenario,
activeConfiguration.current.measure,
activeConfiguration.current.time_period,
activeConfiguration.current.aggregation_period,
activeConfiguration.current.season,
)
.then(x => {
if (x.items.length === 0) {
activeConfiguration.current = {
...activeConfiguration.current,
...{ measure: 'absolute' },
};
setActive(activeConfiguration.current);
}
});
};

return (
Expand Down

0 comments on commit 8e18920

Please sign in to comment.