Commit 893b350c authored by Philippe Delandmeter's avatar Philippe Delandmeter Committed by Jonathan Lambrechts
Browse files

testcase to test temporal serie reading

parent 0256576c
1970-01-01 00:00:00, 1
1970-01-02 00:00:00, 2
1970-01-03 00:00:00, 3
1970-01-05 00:00:00, 4
1970-01-06 00:00:00, 3
1970-01-07 00:00:00, 3
import slimPre
print('creating netcdf .. ')
(t, d) = slimPre.read_temporal_serie('data.txt', output_netcdf=('test1.nc', 'f'))
slimPre.write_file('test2.nc', region=None, time=t, data=[('f', d)])
tv = [86400*i for i in range(1,6)]
t = slimPre.Time(tv)
d = slimPre.read_temporal_serie('data.txt', time=t, output_netcdf=('test3.nc', 'f'))
slimPre.write_file('test4.nc', region=None, time=t, data=[('f', d)])
print('.. done creating netcdf')
print('evaluating netcdf files .. ')
import dgpy
groups = dgpy.dgGroupCollection('tri.msh')
dgpy.function.getTime().set(4.5*86400)
dof = dgpy.dgDofContainer(groups, 1)
evaluator = dgpy.dgFunctionEvaluator(groups, dof.getFunction())
val = dgpy.fullMatrixDouble(1,1)
for i in range(1,5):
f = dgpy.slimInputRead(('test%d.nc' % i), 'f')
dof.interpolate(f)
evaluator.compute(.3, .3, 0, val)
if abs(val.get(0,0)-3.5)> 1e-9:
dgpy.Msg.Fatal('Bug in either netcdf creation or reading..')
print('.. done evaluating netcdf files')
print('TEST CASE SUCCEEDED !')
$MeshFormat
2.2 0 8
$EndMeshFormat
$PhysicalNames
1
2 1 "sea"
$EndPhysicalNames
$Nodes
3
1 0 0 0
2 1 0 0
3 0 1 0
$EndNodes
$Elements
1
1 2 2 1 1 1 2 3
$EndElements
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment