Opened 2 years ago

Closed 2 years ago

#2565 closed defect (fixed)

petascope - FIX - encoding time subset in netCDF returns invalid values

Reported by: Bang Pham Huu Owned by: Bang Pham Huu
Priority: major Milestone: 10.0
Component: petascope Version: 9.8
Keywords: Cc: Dimitar Misev, ocampos
Complexity: Medium

Description

For example, coverage test has ansi axis's bounds: ["2016-01-01T00:00:00.000Z", "2017-12-31T21:00:00.000Z"] and grid extents [-1, 2193] with time coefficients: https://pastebin.com/b4cNJYQD

This WCPS query returns netCDF file

for $c in (test)
return
  encode(
    $c[ansi("2016-01-01":"2016-12-31"),
      ensemble(1),
      forecast_hour(0),
      Lat(50.92),
      Long(6.36)
    ],
  "application/netcdf"
)

and it has output with ncdump -c as:

ansi = 151940.875, 151941, 151941.125, 151941.25, 151941.375, 151941.5, 
    151941.625, 151941.75, 151941.875, 151971.875, 151972 ;

using python code:

import datetime

epoch_time = datetime.datetime(year=1601,month=1,day=1,hour=00,minute=0)
result = epoch_time + datetime.timedelta(days=151940.875)
print(result)
2016-12-31 21:00:00

lowerbound is 2016-12-31 21:00:00 instead of 2016-01-01

Change History (1)

comment:1 by Bang Pham Huu, 2 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.