Skip to content

Commit 31b5385

Browse files
committed
Merge branch 'main' into release/2.0.0
2 parents dffeac7 + 08b3c6b commit 31b5385

File tree

4 files changed

+42
-8
lines changed

4 files changed

+42
-8
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ Please first make sure you read and follow the
99
## You think you found a bug in the code, or have a question in its use
1010
1. use the [issue search](https://github.com/iterorganization/IMAS-Python/issues)
1111
to check if someone already created a similar issue;
12-
3. if not, make a **new issue** to describe your problem or question.
12+
2. if not, make a **new issue** to describe your problem or question.
1313
In the case of a bug suspiscion, please try to give all the relevant
1414
information to allow reproducing the error or identifying
1515
its root cause (version of the IMAS-Python, OS and relevant
1616
dependencies, snippet of code);
17-
4. apply relevant labels to the issue.
17+
3. apply relevant labels to the issue.
1818

1919
## You want to make or ask some change to the code
2020
1. use the [issue search](https://github.com/iterorganization/IMAS-Python/issues)
2121
to check if someone already proposed a similar idea/change;
22-
3. if not, create a **new issue** to describe what change you would like to see
22+
2. if not, create a **new issue** to describe what change you would like to see
2323
implemented and specify it if you intend to work on it yourself or if some help
2424
will be needed;
25-
4. wait until some kind of consensus is reached about your idea being relevant,
25+
3. wait until some kind of consensus is reached about your idea being relevant,
2626
at which time the issue will be assigned (to you or someone else who can work on
2727
this topic);
28-
5. if you do the development yourself, fork the repository to your own Github
28+
4. if you do the development yourself, fork the repository to your own Github
2929
profile and create your own feature branch off of the latest develop commit.
3030
Make sure to regularly sync your branch with the latest commits from `develop`
3131
(find instructions
3232
[here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork));
33-
6. when your development is ready, create a pull request (find instructions
33+
5. when your development is ready, create a pull request (find instructions
3434
[here](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork)).
3535

3636

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@ factory = imas.IDSFactory()
2828
equilibrium = factory.equilibrium()
2929
print(equilibrium)
3030

31-
equilibrium.ids_properties.homogeneous_time = imas.ids_defs.IDS_TIME_MODE_HETEROGENEOUS
31+
equilibrium.ids_properties.homogeneous_time = imas.ids_defs.IDS_TIME_MODE_HOMOGENEOUS
3232
equilibrium.ids_properties.comment = "testing"
33+
equilibrium.time = [0.01]
3334

3435
with imas.DBEntry("imas:hdf5?path=./testdb","w") as dbentry:
3536
dbentry.put(equilibrium)
37+
38+
# or without imas_core dependency
39+
with imas.DBEntry("./test.nc","w") as dbentry:
40+
dbentry.put(equilibrium)
41+
3642
```
3743

3844
A quick 5 minutes introduction is available in the documentation generated from `/docs/sources/intro.rst`.

imas/backends/db_entry_impl.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,30 @@ class GetSampleParameters:
3636
"""See :param:`imas.db_entry.DBEntry.get_sample.interpolation_method`."""
3737

3838

39+
@dataclass
40+
class GetSliceParameters:
41+
"""Helper class to store parameters to get_slice."""
42+
43+
time_requested: float
44+
"""See :param:`imaspy.db_entry.DBEntry.get_slice.time_requested`."""
45+
interpolation_method: int
46+
"""See :param:`imaspy.db_entry.DBEntry.get_slice.interpolation_method`."""
47+
48+
49+
@dataclass
50+
class GetSampleParameters:
51+
"""Helper class to store parameters to get_sample."""
52+
53+
tmin: float
54+
"""See :param:`imaspy.db_entry.DBEntry.get_sample.tmin`."""
55+
tmax: float
56+
"""See :param:`imaspy.db_entry.DBEntry.get_sample.tmax`."""
57+
dtime: Optional[numpy.ndarray]
58+
"""See :param:`imaspy.db_entry.DBEntry.get_sample.dtime`."""
59+
interpolation_method: Optional[int]
60+
"""See :param:`imaspy.db_entry.DBEntry.get_sample.interpolation_method`."""
61+
62+
3963
class DBEntryImpl(ABC):
4064
"""Interface for DBEntry implementations."""
4165

imas/backends/imas_core/db_entry_helpers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,15 @@ def get_children(
7777
getattr(structure, name)._IDSPrimitive__value = data
7878

7979

80-
def _get_child(child: IDSBase, ctx: LazyALContext):
80+
def _get_child(child: IDSBase, ctx: Optional[LazyALContext]):
8181
"""Get a single child when required (lazy loading)."""
8282
# NOTE: changes in this method must be propagated to _get_children and vice versa
8383
# Performance: this method is specialized for the lazy get
8484

85+
# ctx can be None when the parent structure does not exist in the on-disk DD version
86+
if ctx is None:
87+
return # There is no data to be loaded
88+
8589
time_mode = ctx.time_mode
8690
if time_mode == IDS_TIME_MODE_INDEPENDENT and child.metadata.type.is_dynamic:
8791
return # skip dynamic (time-dependent) nodes

0 commit comments

Comments
 (0)