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

readUBC: loading either 2D or 3D mesh #54

Merged
merged 13 commits into from
Jun 1, 2017
Merged

readUBC: loading either 2D or 3D mesh #54

merged 13 commits into from
Jun 1, 2017

Conversation

thast
Copy link
Member

@thast thast commented May 3, 2017

  • 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

@thast
Copy link
Member Author

thast commented May 3, 2017

I tested it on one of my mesh and it worked. Is there anything to do with regards to testing for discretize?

@lheagy
Copy link
Member

lheagy commented May 3, 2017

@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

@lheagy
Copy link
Member

lheagy commented May 6, 2017

@thast: would you mind updating this branch so it is inline with the latest master?

@codecov
Copy link

codecov bot commented May 7, 2017

Codecov Report

Merging #54 into dev will increase coverage by 0.09%.
The diff coverage is 88.23%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
discretize/MeshIO.py 83.09% <88.23%> (+0.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d4a5e9d...8b69305. Read the comment docs.

@thast
Copy link
Member Author

thast commented May 7, 2017

job 267 1 - simpeg discretize - travis ci 2017-05-07 13-02-10

@lheagy
Copy link
Member

lheagy commented May 12, 2017

@thast: I have restarted the tests. If it was just a link failure, then hopefully they should pass.

Copy link
Member

@lheagy lheagy left a 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

:rtype: TensorMesh
:return: SimPEG TensorMesh 2D object

Created on Thu Nov 12 13:14:10 2015
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

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

done


:param string fileName: path to the UBC GIF mesh file
:rtype: TensorMesh
:return: SimPEG TensorMesh 2D object
Copy link
Member

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 :)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

# Read down the file and unpack dx vector
def unpackdx(fid, nrows):
for ii in range(nrows):

Copy link
Member

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

Copy link
Member Author

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.

# Start with dx block
# First line specifies the number of rows for x-cells
line = fopen.readline()
nl = np.array(line.split(), dtype=float)
Copy link
Member

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 ??
image

Copy link
Member Author

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 thast changed the title add readUBC_DC2DMesh to MeshIO methods readUBC: loading either 2D or 3D mesh May 13, 2017
@lheagy
Copy link
Member

lheagy commented May 16, 2017

@thast: could you please change the base of this pr so that it goes on to dev instead of master? Thanks!
image

@thast thast changed the base branch from master to dev May 16, 2017 21:59
@thast
Copy link
Member Author

thast commented May 29, 2017

Not sure now why one Travis Pass and not the other one (it does not seem to come from a file I change). any idea?
job 309 1 - simpeg discretize - travis ci 2017-05-29 13-30-54

Copy link
Member

@lheagy lheagy left a 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 :)

@thast thast merged commit 7e51b92 into dev Jun 1, 2017
@thast thast deleted the readUBC_DC2DMesh branch June 1, 2017 23:48
@lheagy lheagy mentioned this pull request Jun 12, 2017
Merged
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants