Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Valid min and valid max #168

Merged
merged 5 commits into from
Jan 17, 2025
Merged

Conversation

jeandet
Copy link
Member

@jeandet jeandet commented Dec 13, 2024

closes #161


class DataContainerProtocol(Protocol[T]):
def select(self, indices, inplace=False) -> T:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
speasy/core/data_containers.py Fixed Show fixed Hide fixed

@staticmethod
def from_dictionary(dictionary: Dict[str, str or Dict[str, str] or List], dtype=np.float64) -> T:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
speasy/core/data_containers.py Fixed Show fixed Hide fixed
speasy/core/data_containers.py Fixed Show fixed Hide fixed

@property
def values(self) -> np.array:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
speasy/core/data_containers.py Fixed Show fixed Hide fixed
speasy/core/data_containers.py Fixed Show fixed Hide fixed

@property
def nbytes(self) -> int:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
tests/test_speasy_variable.py Fixed Show fixed Hide fixed
speasy/core/data_containers.py Fixed Show fixed Hide fixed

@staticmethod
def reserve_like(other: T, length: int = 0) -> T:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
...

def __getitem__(self, key) -> T:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
...

def __setitem__(self, k, v: Union[T, float, int]):
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
...

def __len__(self) -> int:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@property
def shape(self):
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@property
def name(self) -> str:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@property
def nbytes(self) -> int:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
tests/test_speasy_variable.py Fixed Show fixed Hide fixed
...

def to_dictionary(self, array_to_list=False) -> Dict[str, object]:
...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.
@jeandet jeandet force-pushed the valid_min_and_valid_max branch from 9ebf798 to 8bd20df Compare December 15, 2024 17:14
@jeandet jeandet force-pushed the valid_min_and_valid_max branch 2 times, most recently from e0c2f14 to 6fbed5b Compare January 9, 2025 10:29
@jeandet jeandet marked this pull request as ready for review January 9, 2025 10:36
@jeandet jeandet requested a review from brenard-irap January 9, 2025 10:36
@jeandet jeandet added bug Something isn't working enhancement New feature or request labels Jan 9, 2025
@jeandet jeandet added this to the 1.5 milestone Jan 9, 2025
Copy link
Collaborator

@brenard-irap brenard-irap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very usefull!

But I detect a problem when I apply a condition on a vector:

import speasy as spz
data = spz.get_data(spz.inventories.tree.cda.ACE.MAG.AC_H0_MFI.BGSM, '2008-01-01T00:00:00', '2008-01-01T00:10:00')
print(data[data<0].time)
['2008-01-01T00:00:08.000000000' '2008-01-01T00:00:08.000000000'
 '2008-01-01T00:00:24.000000000' '2008-01-01T00:00:24.000000000'
 '2008-01-01T00:00:40.000000000' '2008-01-01T00:00:40.000000000'
 '2008-01-01T00:00:56.000000000' '2008-01-01T00:00:56.000000000'
 '2008-01-01T00:01:12.000000000' '2008-01-01T00:01:12.000000000'
 '2008-01-01T00:01:28.000000000' '2008-01-01T00:01:28.000000000'
 '2008-01-01T00:01:44.000000000' '2008-01-01T00:01:44.000000000'
 '2008-01-01T00:02:00.000000000' '2008-01-01T00:02:00.000000000'
 '2008-01-01T00:02:16.000000000' '2008-01-01T00:02:16.000000000'
 '2008-01-01T00:02:32.000000000' '2008-01-01T00:02:32.000000000'
 '2008-01-01T00:02:48.000000000' '2008-01-01T00:02:48.000000000'
 '2008-01-01T00:03:04.000000000' '2008-01-01T00:03:04.000000000'
 '2008-01-01T00:03:20.000000000' '2008-01-01T00:03:20.000000000'
 '2008-01-01T00:03:36.000000000' '2008-01-01T00:03:36.000000000'
 '2008-01-01T00:03:52.000000000' '2008-01-01T00:03:52.000000000'
 '2008-01-01T00:04:08.000000000' '2008-01-01T00:04:08.000000000'
 '2008-01-01T00:04:24.000000000' '2008-01-01T00:04:24.000000000'
 '2008-01-01T00:04:40.000000000' '2008-01-01T00:04:40.000000000'
 '2008-01-01T00:04:56.000000000' '2008-01-01T00:04:56.000000000'
 '2008-01-01T00:05:12.000000000' '2008-01-01T00:05:12.000000000'
 '2008-01-01T00:05:28.000000000' '2008-01-01T00:05:28.000000000'
 '2008-01-01T00:05:44.000000000' '2008-01-01T00:05:44.000000000'
 '2008-01-01T00:06:00.000000000' '2008-01-01T00:06:00.000000000'
 '2008-01-01T00:06:16.000000000' '2008-01-01T00:06:16.000000000'
 '2008-01-01T00:06:32.000000000' '2008-01-01T00:06:32.000000000'
 '2008-01-01T00:06:48.000000000' '2008-01-01T00:07:04.000000000'
 '2008-01-01T00:07:20.000000000' '2008-01-01T00:07:36.000000000'
 '2008-01-01T00:07:52.000000000' '2008-01-01T00:08:08.000000000'
 '2008-01-01T00:08:24.000000000' '2008-01-01T00:08:40.000000000'
 '2008-01-01T00:08:56.000000000' '2008-01-01T00:09:12.000000000'
 '2008-01-01T00:09:12.000000000' '2008-01-01T00:09:28.000000000'
 '2008-01-01T00:09:28.000000000' '2008-01-01T00:09:44.000000000']

It seems that a record is duplicated each time that the condition is satisfied on a component

I have something similar with sanitized method:

import speasy as spz

data = spz.get_data(spz.inventories.tree.cda.ACE.MAG.AC_H0_MFI.BGSM, '2008-01-16T15:23:00', '2008-01-16T15:25:00')

print(data.time)
print(data.sanitized().time)
>>> print(data.time)
['2008-01-16T15:23:01.000000000' '2008-01-16T15:23:17.000000000'
 '2008-01-16T15:23:33.000000000' '2008-01-16T15:23:49.000000000'
 '2008-01-16T15:24:05.000000000' '2008-01-16T15:24:21.000000000'
 '2008-01-16T15:24:37.000000000' '2008-01-16T15:24:53.000000000']
>>> print(data.sanitized().time)
['2008-01-16T15:23:01.000000000' '2008-01-16T15:23:01.000000000'
 '2008-01-16T15:23:01.000000000' '2008-01-16T15:23:17.000000000'
 '2008-01-16T15:23:17.000000000' '2008-01-16T15:23:17.000000000'
 '2008-01-16T15:23:33.000000000' '2008-01-16T15:23:33.000000000'
 '2008-01-16T15:23:33.000000000' '2008-01-16T15:24:05.000000000'
 '2008-01-16T15:24:05.000000000' '2008-01-16T15:24:05.000000000'
 '2008-01-16T15:24:21.000000000' '2008-01-16T15:24:21.000000000'
 '2008-01-16T15:24:21.000000000' '2008-01-16T15:24:37.000000000'
 '2008-01-16T15:24:37.000000000' '2008-01-16T15:24:37.000000000'
 '2008-01-16T15:24:53.000000000' '2008-01-16T15:24:53.000000000'
 '2008-01-16T15:24:53.000000000']

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
It is now possible to do something like var[var>10]=52

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
@jeandet jeandet force-pushed the valid_min_and_valid_max branch from 6fbed5b to 2f4e13d Compare January 16, 2025 15:20
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
@jeandet jeandet force-pushed the valid_min_and_valid_max branch from 2f4e13d to 924c97a Compare January 16, 2025 15:28
Copy link
Collaborator

@brenard-irap brenard-irap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@jeandet jeandet merged commit 9d8bb19 into SciQLop:main Jan 17, 2025
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SpeasyVariable does not check VALIDMIN and VALIDMAX
2 participants