idies / pyJHTDB

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

Kernel keep dying while using getCutout #34

Open ehsankharazmi opened 3 years ago

ehsankharazmi commented 3 years ago

Hi,

I was trying to retrieve the Channel velocity data by using getCutout method and it keeps killing the python kernel. We tested with default api getCutout as well and it does the same. I think this is related to issue#30 and I will appreciate your help. A simple MWE is given as follows;

velocity = lJHTDB.getCutout(
    data_set = 'channel',
    field='u',
    time_step=tidx,
    start = np.array([x0, y0, z0]),
    end  = np.array(cut_dims),
    step  = np.array([1, 1, 1]),
    filter_width = 1)  

I will appreciate your quick response.

Thanks! EK

shervinsahba commented 2 years ago

I'm still getting familiar with the dataset, but the error may be from JHTDB's switch to 1-indexing from 0-indexing in the space and time coordinates. If you think that's the case with your query, try something like

import numpy as np
import pyJHTDB

lJHTDB = pyJHTDB.libJHTDB()
lJHTDB.initialize()
auth_token = "<your auth token>"   #<--- AUTH
lJHTDB.add_token(auth_token)

result = lJHTDB.getbigCutout(
        data_set='isotropic1024coarse', fields='u', 
        t_start=1, t_end=3, t_step=1,
        start=np.array([1, 1, 1], dtype = int),
        end=np.array([1024, 1024, 1], dtype = int),
        step=np.array([16, 16, 1], dtype = int),
        filter_width=4,
        filename='cutout')

lJHTDB.finalize()

If you change t_start or one of the spatial starts to 0, it will fail with error

"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Exception: JHTDB started using 1-based indexing from Sept 16. Please update your JHTDB library if you have not done so.

If you're using Jupyter, the error may not print but it should be in the console.