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

Some changes necessary for subsurface #118

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
� Conflicts:
�	striplog/striplog.py
  • Loading branch information
Leguark committed May 6, 2021
commit 0034d24caecf19dbf497a8f03148940acb5259fe
35 changes: 27 additions & 8 deletions striplog/striplog.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ def from_csv(cls, filename=None,
return cls(list_of_Intervals, source=source)

@classmethod
def from_dict(cls, dict,
def from_dict2(cls, dict,
lexicon=None,
points=False,
include=None,
Expand All @@ -692,7 +692,7 @@ def from_dict(cls, dict,
stop=None,
):
"""
Load from a CSV file or text.
Load from a dictionary reusing `from_csv` post processing.

Args
dict (dict): python dict containing the data.
Expand Down Expand Up @@ -734,6 +734,25 @@ def from_dict(cls, dict,

return cls(list_of_Intervals, source=source)

@classmethod
def from_dict(cls, dictionary):
"""
Take a dictionary of the form name:depth and return a striplog of
complete intervals.
"""
d_sorted = sorted(dictionary.items(), key=lambda i: i[1])
names = [i[0] for i in d_sorted]
tops_ = [i[1] for i in d_sorted]
bases_ = tops_[1:] + [tops_[-1]+1]
comps_ = [Component({'formation': name}) for name in names]

list_of_Intervals = []
for top, base, comp in zip(tops_, bases_, comps_):
iv = Interval(top=top, base=base, components=[comp])
list_of_Intervals.append(iv)

return cls(list_of_Intervals)

@classmethod
def from_descriptions(cls, text,
lexicon=None,
Expand Down Expand Up @@ -1132,7 +1151,7 @@ def copy(self):
order=self.order,
source=self.source)





Expand Down Expand Up @@ -1267,7 +1286,7 @@ def to_log(self,
you are asking for. It's up to you to make sure the function
does what you want.
bins (bool): Whether to return the index of the items from the
lookup table. If False, then the item itself will be returned.
lookup table. If False, then the item itself will be returned.
dtype (str): The NumPy dtype string for the output log.
table (list): Provide a look-up table of values if you want. If you
don't, then it will be constructed from the data.
Expand Down Expand Up @@ -2660,7 +2679,7 @@ def from_macrostrat(cls, lng, lat, buffer_size=0.2):
This is simply a helper function to make things easier, but it
works because we know what our data looks like in advance.

Note: In order to plot this, you will need to add space for text and
Note: In order to plot this, you will need to add space for text and
other decoration. This simply gives a Striplog back which _can_
be plotted.

Expand All @@ -2677,8 +2696,8 @@ def from_macrostrat(cls, lng, lat, buffer_size=0.2):
lat = 44.4454632
buffer_size = 0.3
striplog.striplog.from_macrostrat(lng, lat, buffer_size)
{'top': Position({'middle': 358.9, 'units': 'm'}),
'base': Position({'middle': 419.2, 'units': 'm'}),
{'top': Position({'middle': 358.9, 'units': 'm'}),
'base': Position({'middle': 419.2, 'units': 'm'}),
'description': '', 'data': {}, 'components': [Component({
'map_id': 948660.0, 'scale': 'small', 'source_id': 7.0,
'name': 'Devonian plutonic: undivided granitic rocks',
Expand All @@ -2702,7 +2721,7 @@ def from_macrostrat(cls, lng, lat, buffer_size=0.2):
't_int': 112.0, 'b_int': 122.0, 'color': '#409963',
'source': 'MacroStrat.org (CC-BY)})]}
"""
# Get the
# Get the
features = utils.geology_from_macrostrat(lng=lng, lat=lat,
buffer_size=buffer_size)

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.