Skip to content

Commit

Permalink
Forecast Precisions (bcgov#3759)
Browse files Browse the repository at this point in the history
Limits precision for temp and wind speed (both as integers)
  • Loading branch information
brettedw committed Jul 3, 2024
1 parent 97eaae2 commit f9cc37d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions web/src/api/moreCast2API.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ export const marshalMoreCast2ForecastRecords = (forecasts: MoreCast2ForecastRow[
for_date: forecast.forDate.toMillis(),
precip: forecast.precip.value,
rh: forecast.rh.value,
temp: forecast.temp.value,
temp: Math.round(forecast.temp.value),
wind_direction: Math.round(forecast.windDirection.value),
wind_speed: forecast.windSpeed.value,
wind_speed: Math.round(forecast.windSpeed.value),
grass_curing: forecast.grassCuring.value
}
})
Expand Down
4 changes: 2 additions & 2 deletions web/src/features/moreCast2/components/MoreCast2Column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ export class IndeterminateField implements ColDefGenerator, ForecastColDefGenera
}
}

export const tempForecastField = new IndeterminateField('temp', TEMP_HEADER, 'number', 1, true)
export const tempForecastField = new IndeterminateField('temp', TEMP_HEADER, 'number', 0, true)
export const rhForecastField = new IndeterminateField('rh', RH_HEADER, 'number', 0, true)
export const windDirForecastField = new IndeterminateField('windDirection', WIND_DIR_HEADER, 'number', 0, true)
export const windSpeedForecastField = new IndeterminateField('windSpeed', WIND_SPEED_HEADER, 'number', 1, true)
export const windSpeedForecastField = new IndeterminateField('windSpeed', WIND_SPEED_HEADER, 'number', 0, true)
export const precipForecastField = new IndeterminateField('precip', PRECIP_HEADER, 'number', 1, true)
export const gcForecastField = new IndeterminateField('grassCuring', GC_HEADER, 'number', 0, false)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('MoreCast2Column', () => {
describe('TempForecastField', () => {
it('should have the desired configuration', () => {
const instance = tempForecastField
expect(tempForecastField.precision).toEqual(1)
expect(tempForecastField.precision).toEqual(0)
expect(JSON.stringify(instance.generateColDef())).toEqual(
JSON.stringify({
field: tempForecastField.field,
Expand Down Expand Up @@ -108,7 +108,7 @@ describe('MoreCast2Column', () => {
describe('WindSpeedForecastField', () => {
it('should have the desired configuration', () => {
const instance = windSpeedForecastField
expect(windSpeedForecastField.precision).toEqual(1)
expect(windSpeedForecastField.precision).toEqual(0)
expect(JSON.stringify(instance.generateColDef())).toEqual(
JSON.stringify({
field: windSpeedForecastField.field,
Expand Down

0 comments on commit f9cc37d

Please sign in to comment.