-
Notifications
You must be signed in to change notification settings - Fork 35
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
readUBC: loading either 2D or 3D mesh #54
Conversation
thast
commented
May 3, 2017
•
edited
Loading
edited
- discretize.TensorMesh.readUBC is now a wrapper for loading either 2D or 3D mesh
- discretize.TensorMesh.readUBC can take care of recognizing if the file is a 2D or 3D UBC mesh, or it can be an input given by the user (arg: meshdim)
- the original functions are now hidden class function under discretize.TensorMesh._readUBC_3DMesh and discretize.TensorMesh._readUBC_2DMesh
- comments in UBC files are assumed to be marked with "!" in front
I tested it on one of my mesh and it worked. Is there anything to do with regards to testing for discretize? |
@thast: you can add a test similar to https://github.com/simpeg/discretize/blob/master/tests/base/test_tensor_io.py#L50. A small ubc mesh file is included in the test directory, loaded in, and some sanity-checks run |
@thast: would you mind updating this branch so it is inline with the latest master? |
Codecov Report
@@ Coverage Diff @@
## dev #54 +/- ##
==========================================
+ Coverage 76.15% 76.25% +0.09%
==========================================
Files 17 17
Lines 4748 4792 +44
==========================================
+ Hits 3616 3654 +38
- Misses 1132 1138 +6
Continue to review full report at Codecov.
|
@thast: I have restarted the tests. If it was just a link failure, then hopefully they should pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bringing this over @thast! I have left a couple minor comments - if you don't mind, could you take a look and address these? Please let me know if you have any questions
discretize/MeshIO.py
Outdated
:rtype: TensorMesh | ||
:return: SimPEG TensorMesh 2D object | ||
|
||
Created on Thu Nov 12 13:14:10 2015 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest not necessarily tracking this - all of this info is in the git log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
discretize/MeshIO.py
Outdated
|
||
:param string fileName: path to the UBC GIF mesh file | ||
:rtype: TensorMesh | ||
:return: SimPEG TensorMesh 2D object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here, this is a discretize TensorMesh
now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
discretize/MeshIO.py
Outdated
# Read down the file and unpack dx vector | ||
def unpackdx(fid, nrows): | ||
for ii in range(nrows): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you mind opening up this file in a text editor with a pep8 linter? there is a bit of whitespace cleanup that can be done (eg within the function there should be at most one line between each code statement). To get up and running with a sublime pep8 linter, please see https://github.com/SublimeLinter/SublimeLinter-pep8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did. Thanks. Should have take care of most of it.
discretize/MeshIO.py
Outdated
# Start with dx block | ||
# First line specifies the number of rows for x-cells | ||
line = fopen.readline() | ||
nl = np.array(line.split(), dtype=float) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is causing the failure (https://travis-ci.org/simpeg/discretize/jobs/229743764#L6327). This should be dtype=int
??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, that was it.
@thast: could you please change the base of this pr so that it goes on to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good @thast, nice work :)