idies / pyJHTDB

Python wrapper for the Johns Hopkins turbulence database library
Apache License 2.0
100 stars 47 forks source link

following #26 #27

Closed alexlib closed 5 years ago

alexlib commented 5 years ago

the #26 now apparently works, the errors are gone. but the test fails and I"m afraid it is because the library has not been compiled

`Data is requested at time 2.0060000000000002 Traceback (most recent call last): File "", line 1, in File "C:\Users\alex\Downloads\pyjhtdb\pyJHTDB\test.py", line 67, in test_plain lTDB = pyJHTDB.libJHTDB() File "C:\Users\alex\Downloads\pyjhtdb\pyJHTDB\libJHTDB.py", line 45, in init os.path.abspath(os.path.join(lib_location, os.path.pardir))) File "C:\Users\alex\Miniconda3\envs\pyjhtdb\lib\site-packages\numpy\ctypeslib.py", line 157, in load_library raise OSError("no file with expected extension") OSError: no file with expected extension

`

zzwz02 commented 5 years ago

I see. Thank you for pointing this out. seems the problem is a bit complex. I have no idea how to fix it at the moment. but would you mind trying zeep python package (https://python-zeep.readthedocs.io/en/master/)?

import zeep

client = zeep.Client('http://turbulence.pha.jhu.edu/service/turbulence.asmx?WSDL')
ArrayOfPoint3 = client.get_type('ns0:ArrayOfPoint3')
SpatialInterpolation = client.get_type('ns0:SpatialInterpolation')
TemporalInterpolation = client.get_type('ns0:TemporalInterpolation')

Point3 = client.get_type('ns0:Point3')
temp1=Point3(x=0.1, y=0.1, z=0.1)
temp2=Point3(x=1.1, y=1.1, z=1.1)
temp3=Point3(x=2.1, y=2.1, z=2.1)
point = ArrayOfPoint3([temp1,temp2,temp3])

print(point)
print(client.service.GetVelocity("jhu.edu.pha.turbulence.testing-200711","isotropic1024coarse", 0.6, 
                                 SpatialInterpolation("None"), TemporalInterpolation("None"), point, ""))

output:

{
    'Point3': [
        {
            'x': 0.1,
            'y': 0.1,
            'z': 0.1
        },
        {
            'x': 1.1,
            'y': 1.1,
            'z': 1.1
        },
        {
            'x': 2.1,
            'y': 2.1,
            'z': 2.1
        }
    ]
}
[{
    'x': -0.103202209,
    'y': -1.22528827,
    'z': -0.03917983
}, {
    'x': -0.321914315,
    'y': -0.499108434,
    'z': -1.07386518
}, {
    'x': -0.12327221,
    'y': 1.19931781,
    'z': -0.03163197
}]

Put "" (empty string) for the last parameter. Details about the service can be found using the command
python -mzeep http://turbulence.pha.jhu.edu/service/turbulence.asmx?WSDL
I will also try to write a package based on this. but it takes time.

alexlib commented 5 years ago

works perfectly. thanks. How to replace the calls of .libJHTDB by zeep calls for Lagrangian tracking and snapshots download? Do you have more examples of using zeep?

thanks @zzwz02

zzwz02 commented 5 years ago

This should work. point and SpatialInterpolation are defined in the same way as above.

StartTime=0.1
EndTime=0.2
dt=0.02
print(client.service.GetPosition("jhu.edu.pha.turbulence.testing-200711","isotropic1024coarse", 
    StartTime, EndTime, dt, SpatialInterpolation("None"), point, ""))
alexlib commented 5 years ago

thanks @zzwz02

zzwz02 commented 5 years ago

It seems it's very slow to generate the a lot of Point3 structures: it takes me 1 minute to generate 1 million Point3. Do you have the same problem?

alexlib commented 5 years ago

@zzwz02 not tested yet

zzwz02 commented 5 years ago

see examples\Use_JHTDB_in_windows.ipynb We provide some examples. Thanks for sharing the information