das-developers / das2java

The original das2 library. Provides interactive publication-ready 2-D plotting
https://das2.org
GNU Lesser General Public License v3.0
4 stars 0 forks source link

FileStorageModel mishandles delta=6 qualifier #70

Closed jbfaden closed 11 months ago

jbfaden commented 11 months ago

The following Autoplot script demos where the delta=6 qualifier is mishandled in Das2, causing Autoplot to load two files when only one was needed, and thus running out of memory. $(H;delta=6) should imply 06:00 to 12:00, not 10:00 to 16:00.

setScriptDescription('''This demos where the FileStorageModel mishandles delta.''')

from org.das2.util.filesystem import FileSystem
from org.das2.fsm import FileStorageModel
fsm= FileStorageModel.create(FileSystem.create('file:/tmp/jbf'),'$Y$m$d_$(H;delta=6)')
print fsm.quantize(datumRange('2021-01-17T10:49 to 2021-01-17T10:50'))
print '2021-01-17 06:00 to 12:00 it should be'
jbfaden commented 11 months ago

The FileStorageModel uses TimeParser to implement the times, which wasn't looking for delta, but did support "span". "delta" is the term we agreed on for the URI_Templates, and this should be supported as well.

Note the TimeParser does not faithfully implement URI_Templates, since it preceded URI_Templates. It needs to be updated to completely support URI_Templates (probably using the URI_Templates library https://github.com/hapi-server/uri-templates).

I've made it support delta in this case.