resourceURI= getParam( 'resourceURI', 'http://autoplot.org/data/C1_CP_EDI_EGD__$Y$m$d_V03.cef', 'example file to load', [ 'data_$Y_$(m)_$(d;delta=7;phasestart=2019-05-05).qds', 'http://autoplot.org/data/C1_CP_EDI_EGD__$Y$m$d_V03.cef', 'C1_CP_EDI_EGD__$Y$m$d_$(enum,values=A|B).cef' ] ) timerange= getParam( 'timerange', '2005-02-12/2005-02-19', 'timerange to load' ) generate= getParam( 'generate', 'F', 'Generation doesn''t list remote folders', ['T','F'] ) if ( len(timerange.split(' '))==10 ): # make it easier to use Jon V.'s document "uri_template_test_cases.txt" trs= timerange.split(' ') timerange= '-'.join( trs[0:3] ) + 'T' + ':'.join( trs[3:5] ) + '/' + '-'.join( trs[5:8] ) + 'T' + ':'.join( trs[8:10] ) drtr= DatumRangeUtil.parseTimeRange(timerange) import time count=0 if ( False ): print params print '# resourceURI='+resourceURI print '# timerange='+timerange print '# generate='+generate print '
' from java.lang import System t0= System.currentTimeMillis() if ( generate=='T' ): if ( resourceURI.find('$v')>-1 ): print 'Template cannot contain $v.' count=-1 else: tp= TimeParser.create(resourceURI) i1= resourceURI.find('$(enum') if ( i1>-1 ): ix= resourceURI.find('$(enum',i1+6) if (ix>-1 ): print 'Template can only contain one $(enum).' count=-1 else: fh= tp.getFieldHandlerByCode('enum') enums= fh.getValues() id= fh.getId() else: enums= [''] id= '' from java.util import Collections st= tp.format( drtr.min(), None, Collections.singletonMap( id, enums[0] ) ) dr= tp.parse( st,None ).getTimeRange() print( "search limited to '+timerange+'
' print 'Time Range | Generated filename | |
'+ dr.toString() + ' | '+st + ' | |
Search limited to 10000 results. |
Filename | Time Range | Version |
'+root + n + ' | '+tr.toString() + ' | ' + v +' | ' count= count+1 print '