idies / pyJHTDB

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

Automatically convert input coordinates to Numpy float32 array #14

Closed petebachant closed 1 year ago

petebachant commented 9 years ago

Addresses #13.

chichilalescu commented 9 years ago

Sorry for replying so late. I'm not sure whether we should do it like this. I specifically put in that error message so that people would pay attention to what is being fed to getData. Specifically, it happened to me personally to construct points on the grid from indices (integers), and forget to multiply by dx or something, and this error message would make me realize I didn't initialize the points properly (whereas this approach would hide the error).

I'll talk to the others, and we'll make a decision about the default behavior.

petebachant commented 9 years ago

Fair enough. My own use case that inspired this was trying to get data at a single point, which made it logical to pass in a 3-tuple. Having to convert this to np.float32 before passing into the function was a little cumbersome.

The prevent errors, it may be better to check that all points passed are inside the simulation domain, rather than checking their type.

chichilalescu commented 9 years ago

Actually, we intentionally allow calls outside the domain, since the domain is in fact periodic. In particular for particle tracking, it makes perfect sense to try to go "outside" the default 2pi^3 domain.

For the channel flow, in the wall-normal direction, an error is raised when requests are made outside the domain, since it's the right thing to do.

On 03/23/2015 10:50 AM, Pete Bachant wrote:

Fair enough. My own use case that inspired this was trying to get data at a single point, which made it logical to pass in a 3-tuple. Having to convert this to |np.float32| before passing into the function was a little cumbersome.

The prevent errors, it may be better to check that all points passed are inside the simulation domain, rather than checking their type.

— Reply to this email directly or view it on GitHub https://github.com/idies/pyJHTDB/pull/14#issuecomment-85033627.

Cristian Constantin Lalescu Postdoctoral Researcher Department of Applied Mathematics & Statistics 3400 North Charles Street The Johns Hopkins University Baltimore, Maryland 21218-2682 USA

petebachant commented 9 years ago

Ah, I see. My mistake. Well, at the very least the documentation could specify that points are not indices. Up to you guys, of course.