Skip to content

Commit 7ec354b

Browse files
committed
updated CHANGELOG and docstrings
1 parent 4243676 commit 7ec354b

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

CHANGELOG

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ The rules for this file:
1313
* accompany each entry with github issue/PR number (Issue #xyz)
1414

1515
-------------------------------------------------------------------------------
16-
??/??/???? orbeckst
16+
??/??/???? orbeckst, spyke7
1717

1818
* 1.1.1
1919

20-
Fixes
20+
Changes
21+
22+
* `from_grid()` and `native` functions are added inside mrc and OpenDX,
23+
which is used by `Grid._export_<FORMAT>` and a new `convert_to()` is added
24+
(issue #161, PR #164)
25+
26+
Fixes
2127

2228

2329
01/22/2026 IAlibay, ollyfutur, conradolandia, orbeckst, PlethoraChutney,

gridData/OpenDX.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,21 @@ def __init__(self,classid='0',components=None,comments=None):
525525

526526
@staticmethod
527527
def from_grid(grid, type=None, typequote='"', **kwargs):
528+
"""Create OpenDX field from Grid.
529+
530+
Parameters
531+
----------
532+
grid : Grid
533+
type : str, optional
534+
typequote : str, optional
535+
**kwargs
536+
Additional keyword arguments (currently unused)
537+
538+
Returns
539+
-------
540+
field
541+
OpenDX field wrapper
542+
"""
528543
comments = [
529544
"OpenDX density file written by gridDataFormats.Grid.export()",
530545
"File format: http://opendx.sdsc.edu/docs/html/pages/usrgu068.htm#HDREDF",
@@ -548,6 +563,7 @@ def from_grid(grid, type=None, typequote='"', **kwargs):
548563

549564
@property
550565
def native(self):
566+
"""Return native object"""
551567
return self
552568

553569
def _openfile_writing(self, filename):

gridData/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def _load_plt(self, filename, **kwargs):
605605
self._load(grid=grid, edges=edges, metadata=self.metadata)
606606

607607
def convert_to(self, format_specifier, tolerance=None, **kwargs):
608-
"""Generates an instance of the native object for a given format
608+
"""Returns an instance of the native object for a given format
609609
610610
Implemented formats:
611611
@@ -618,7 +618,7 @@ def convert_to(self, format_specifier, tolerance=None, **kwargs):
618618
----------
619619
format_specifier : str
620620
621-
tolerance : float (default is None)
621+
tolerance : float (default is None) - for OpenVDB
622622
623623
Returns
624624
-------

gridData/mrc.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,21 @@ def __init__(self, filename=None, assume_volumetric=False):
103103

104104
@staticmethod
105105
def from_grid(grid, **kwargs):
106+
"""Create MRC object from a Grid.
107+
108+
Parameters
109+
----------
110+
grid : Grid
111+
Grid object to convert
112+
**kwargs
113+
Additional keyword arguments (currently unused)
114+
115+
Returns
116+
-------
117+
MRC
118+
MRC wrapper object
119+
120+
"""
106121
mrc_obj = MRC()
107122

108123
mrc_obj.array = grid.grid

0 commit comments

Comments
 (0)