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

Inventory copy #2322

Merged
merged 6 commits into from Feb 15, 2019

Conversation

4 participants
@d-chambers
Copy link
Member

d-chambers commented Feb 14, 2019

What does this PR do?

Adds a copy method to Inventory to be consistent with Catalog and Stream which both have copy methods that created deep copies.

Why was it initiated? Any relevant Issues?

PR Checklist

  • Correct base branch selected? master for new features, maintenance_... for bug fixes
  • This PR is not directly related to an existing issue (which has no PR yet).
  • If the PR is making changes to documentation, docs pages can be built automatically.
    Just remove the space in the following string after the + sign: "+ DOCS"
  • If any network modules should be tested for the PR, add them as a comma separated list
    (e.g. clients.fdsn,clients.arclink) after the colon in the following magic string: "+TESTS:"
    (you can also add "ALL" to just simply run all tests across all modules)
  • All tests still pass.
  • Any new features or fixed regressions are be covered via new tests.
  • Any new or changed features have are fully documented.
  • Significant changes have been added to CHANGELOG.txt .
  • First time contributors have added your name to CONTRIBUTORS.txt .

@d-chambers d-chambers added this to the 1.2.0 milestone Feb 14, 2019

@krischer krischer added this to In Progress in Release 1.2.0 Feb 14, 2019

@krischer krischer removed this from In Progress in Release 1.2.0 Feb 14, 2019

@krischer krischer added this to In Progress in Release 1.2.0 Feb 14, 2019

@d-chambers d-chambers moved this from In Progress to Waiting for Review in Release 1.2.0 Feb 14, 2019

d-chambers added some commits Feb 14, 2019

@megies megies force-pushed the inventory_copy branch from c07d251 to e705f20 Feb 14, 2019

@megies

This comment has been minimized.

Copy link
Member

megies commented Feb 14, 2019

Rebased on current master and force-pushed so that we have fresh CI results tomorrow.

>>> from obspy import read_inventory
>>> inv = read_inventory()
>>> inv2 = inv2.copy()

This comment has been minimized.

@ThomasLecocq

ThomasLecocq Feb 15, 2019

Contributor

inv2 = inv.copy()

self.assertEqual(inv, inv2)
# make sure changing inv2 doesnt affect inv
original_latitude = inv2[0][0][0].latitude
inv2[0][0][0].latitudue = original_latitude + 1

This comment has been minimized.

@ThomasLecocq

ThomasLecocq Feb 15, 2019

Contributor

latitudue - latitude

This comment has been minimized.

@ThomasLecocq

ThomasLecocq Feb 15, 2019

Contributor

not sure how to understand this test...

This comment has been minimized.

@Jollyfant

Jollyfant Feb 15, 2019

Contributor

It just checks whether the memory copy works by modifying the copied reference and checking it doesn't touch the original reference.

This comment has been minimized.

@megies

megies Feb 15, 2019

Member

um.. but the latitude is never actually changed anywhere.. so i agree with @ThomasLecocq

This comment has been minimized.

@Jollyfant

Jollyfant Feb 15, 2019

Contributor

I mean the typo has to be fixed.. but the point is to prove that the two objects don't reference the same point in memory

This comment has been minimized.

@megies

megies Feb 15, 2019

Member

Fixed the typo already and also amended the test

megies added some commits Feb 15, 2019

@megies

megies approved these changes Feb 15, 2019

Copy link
Member

megies left a comment

Looks good to me, can be merged on green CI

@megies megies moved this from Waiting for Review to Waiting on CI in Release 1.2.0 Feb 15, 2019

@megies

This comment has been minimized.

Copy link
Member

megies commented Feb 15, 2019

CI all green so far, only 1-2 appveyor jobs not yet done

proposed changes implemented

@ThomasLecocq

This comment has been minimized.

Copy link
Contributor

ThomasLecocq commented Feb 15, 2019

@megies all green (except unrelated evalresp)

@ThomasLecocq ThomasLecocq moved this from Waiting on CI to Waiting for final manual validation by Core Dev in Release 1.2.0 Feb 15, 2019

@megies megies merged commit c465fef into master Feb 15, 2019

2 of 4 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
docker-testbot docker testbot results not available yet
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@megies

This comment has been minimized.

Copy link
Member

megies commented Feb 15, 2019

Bääääm! 🚀

@megies megies deleted the inventory_copy branch Feb 15, 2019

@ThomasLecocq ThomasLecocq moved this from Waiting for final manual validation by Core Dev to Done in Release 1.2.0 Feb 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.