Skip to content

Commit

Permalink
v2.11.0 (#79)
Browse files Browse the repository at this point in the history
* time series viewer time step, variable determination and adherence

* note when datetime var is not known

* prepare v2.11.0
  • Loading branch information
sampsonj authored Dec 9, 2024
1 parent 80c70df commit a947b73
Show file tree
Hide file tree
Showing 21 changed files with 515 additions and 139 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
# production
/build

.next

# misc
.DS_Store
.env.local
Expand Down
52 changes: 45 additions & 7 deletions lib/components/TimeSeriesViewer/StateStorageConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,31 @@ const convertStateForStorage = state => {
// available time steps
const {
availableTimeSteps
} = state;
} = state.timeStep;
if (availableTimeSteps instanceof Set) {
newState.availableTimeSteps = Array.from(availableTimeSteps);
newState.timeStep.availableTimeSteps = Array.from(availableTimeSteps);
} else {
newState.availableTimeSteps = [];
newState.timeStep.availableTimeSteps = [];
}
const {
variables: timeStepVariables
} = state.timeStep;
Object.keys(timeStepVariables).forEach((key, index) => {
const {
variables: timeStepVariablesSet,
dateTimeVariables
} = timeStepVariables[key];
if (timeStepVariablesSet instanceof Set && timeStepVariablesSet.size > 0) {
newState.timeStep.variables[key].variables = Array.from(timeStepVariablesSet);
} else {
newState.timeStep.variables[key].variables = [];
}
if (dateTimeVariables instanceof Set && dateTimeVariables.size > 0) {
newState.timeStep.variables[key].dateTimeVariables = Array.from(dateTimeVariables);
} else {
newState.timeStep.variables[key].dateTimeVariables = [];
}
});
return newState;
};

Expand Down Expand Up @@ -149,15 +168,34 @@ const convertStateFromStorage = state => {
} else {
newState.availableQualityFlags = new Set();
}
// available quality flags
// available time steps
const {
availableTimeSteps
} = state;
} = state.timeStep;
if (Array.isArray(availableTimeSteps)) {
newState.availableTimeSteps = new Set(availableTimeSteps);
newState.timeStep.availableTimeSteps = new Set(availableTimeSteps);
} else {
newState.availableTimeSteps = new Set();
newState.timeStep.availableTimeSteps = new Set();
}
const {
variables: timeStepVariables
} = state.timeStep;
Object.keys(timeStepVariables).forEach((key, index) => {
const {
variables: timeStepVariablesSet,
dateTimeVariables
} = timeStepVariables[key];
if (Array.isArray(timeStepVariablesSet)) {
newState.timeStep.variables[key].variables = new Set(timeStepVariablesSet);
} else {
newState.timeStep.variables[key].variables = new Set();
}
if (Array.isArray(dateTimeVariables)) {
newState.timeStep.variables[key].dateTimeVariables = new Set(dateTimeVariables);
} else {
newState.timeStep.variables[key].dateTimeVariables = new Set();
}
});
return newState;
};
exports.convertStateFromStorage = convertStateFromStorage;
4 changes: 2 additions & 2 deletions lib/components/TimeSeriesViewer/TimeSeriesViewerAxes.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ const TimeStepOption = () => {
const [state, dispatch] = _TimeSeriesViewerContext.default.useTimeSeriesViewerState();
const {
availableTimeSteps
} = state;
} = state.timeStep;
const {
timeStep: selectedTimeStep
} = state.selection;
Expand Down Expand Up @@ -624,7 +624,7 @@ function TimeSeriesViewerAxes() {
}
}, "x Axis (Time)"), /*#__PURE__*/_react.default.createElement("div", {
className: classes.optionsContainer
}, state.availableTimeSteps.size < 3 ? null : /*#__PURE__*/_react.default.createElement("div", {
}, state.timeStep.availableTimeSteps.size < 3 ? null : /*#__PURE__*/_react.default.createElement("div", {
style: {
marginRight: _Theme.default.spacing(4)
}
Expand Down
23 changes: 19 additions & 4 deletions lib/components/TimeSeriesViewer/TimeSeriesViewerContext.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ export namespace DEFAULT_STATE {
export const isDefault: boolean;
}
export const availableQualityFlags: Set<any>;
export const availableTimeSteps: Set<string>;
export namespace timeStep_1 {
export const availableTimeSteps: Set<string>;
const variables_2: {};
export { variables_2 as variables };
}
export { timeStep_1 as timeStep };
}
/**
Time Step Definitions and Functions
Expand Down Expand Up @@ -163,6 +168,7 @@ export const TIME_STEPS: {
'1day': {
key: string;
matchFileTableSuffix: string[];
matchFileTableIncludes: string[];
tmi: string;
seconds: number;
};
Expand Down Expand Up @@ -257,7 +263,10 @@ export function getTestableItems(): {
isDefault: boolean;
};
availableQualityFlags: Set<any>;
availableTimeSteps: Set<string>;
timeStep: {
availableTimeSteps: Set<string>;
variables: {};
};
};
FETCH_STATUS: {
AWAITING_CALL: string;
Expand Down Expand Up @@ -417,7 +426,10 @@ declare function useTimeSeriesViewerState(): {
isDefault: boolean;
};
availableQualityFlags: Set<any>;
availableTimeSteps: Set<string>;
timeStep: {
availableTimeSteps: Set<string>;
variables: {};
};
} | ({
mode: string;
status: string;
Expand Down Expand Up @@ -489,7 +501,10 @@ declare function useTimeSeriesViewerState(): {
isDefault: boolean;
};
availableQualityFlags: Set<any>;
availableTimeSteps: Set<string>;
timeStep: {
availableTimeSteps: Set<string>;
variables: {};
};
} | (() => void))[];
declare namespace TimeSeriesViewerPropTypes {
export function productCode_3(props: any, propName: any, componentName: any): Error | null;
Expand Down
Loading

0 comments on commit a947b73

Please sign in to comment.