Skip to content

Commit

Permalink
[BUG]
Browse files Browse the repository at this point in the history
- Updated some sorting categories to the new pandas behaviour
  • Loading branch information
Leguark committed Oct 9, 2019
1 parent e34cdf5 commit 872c24a
Show file tree
Hide file tree
Showing 6 changed files with 1,109 additions and 363 deletions.
3 changes: 3 additions & 0 deletions gempy/core/gempy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,9 @@ def load_model(name, path=None, recompile=False):
'color': 'str'})
c_ = surf_df.columns[~(surf_df.columns.isin(geo_model.surfaces._columns_vis_drop))]
geo_model.surfaces.df[c_] = surf_df[c_]
geo_model.surfaces.df['series'].cat.reorder_categories(np.asarray(geo_model.series.df.index),
ordered=False, inplace=True)
geo_model.surfaces.sort_surfaces()

geo_model.surfaces.colors.generate_colordict()
geo_model.surfaces.df['series'].cat.set_categories(cat_series, inplace=True)
Expand Down
6 changes: 3 additions & 3 deletions gempy/core/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def modify_order_series(self, new_value: int, idx: str):
"""
self.series.modify_order_series(new_value, idx)

self.surfaces.df['series'].cat.reorder_categories(self.series.df.index.array,
self.surfaces.df['series'].cat.reorder_categories(np.asarray(self.series.df.index),
ordered=False, inplace=True)

self.surfaces.sort_surfaces()
Expand All @@ -291,7 +291,7 @@ def reorder_series(self, new_categories: Union[list, np.ndarray]):
reset the flow control objects.
"""
self.series.reorder_series(new_categories)
self.surfaces.df['series'].cat.reorder_categories(self.series.df.index.array,
self.surfaces.df['series'].cat.reorder_categories(np.asarray(self.series.df.index),
ordered=False, inplace=True)

self.surfaces.sort_surfaces()
Expand Down Expand Up @@ -838,7 +838,7 @@ def update_from_series(self, rename_series: dict = None, reorder_series=True, so
self.surfaces.df['series'].cat.rename_categories(rename_series, inplace=True)

if reorder_series is True:
self.surfaces.df['series'].cat.reorder_categories(self.series.df.index.array,
self.surfaces.df['series'].cat.reorder_categories(np.asarray(self.series.df.index),
ordered=False, inplace=True)
self.series.df.index = self.series.df.index.reorder_categories(self.series.df.index.array,
ordered=False)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
,dtype,output,theano_optimizer,device,verbosity
values,float64,geology,fast_compile,cpu,[]
values,float32,geology,fast_compile,cpu,[]
66 changes: 21 additions & 45 deletions notebooks/data/gempy_models/Greenstone/Greenstone_surfaces.csv
Original file line number Diff line number Diff line change
@@ -1,54 +1,30 @@
,surface,series,order_surfaces,isBasement,color,vertices,edges,id,value_0
3,EarlyGranite,EarlyGranite_Series,1,False,#728f02,"[[ 6.96879938e+05 6.86434000e+06 -1.15160000e+04]
[ 6.97020000e+05 6.86434000e+06 -1.18304876e+04]
[ 6.97020000e+05 6.86430133e+06 -1.19200000e+04]
3,EarlyGranite,EarlyGranite_Series,1,False,#728f02,"[[ 6.96000000e+05 6.86836000e+06 -7.26983536e+02]
[ 6.97020000e+05 6.86918545e+06 -6.08000000e+02]
[ 6.97020000e+05 6.86836000e+06 -8.87661011e+02]
...
[ 7.45781528e+05 6.87774000e+06 -2.04000000e+02]
[ 7.45980000e+05 6.87774000e+06 -5.31349976e+02]
[ 7.45980000e+05 6.87779400e+06 -2.04000000e+02]]","[[ 2 1 0]
[ 3 2 0]
[ 4 2 3]
...
[3512 3568 3569]
[3511 3568 3512]
[3570 3571 3569]]",1,2.61
0,SimpleMafic2,BIF_Series,1,False,#015482,"[[ 7.17372390e+05 6.88444000e+06 -2.04000000e+02]
[ 7.17420000e+05 6.88444000e+06 -2.19525421e+02]
[ 7.17420000e+05 6.88416750e+06 -2.04000000e+02]
...
[ 7.45980000e+05 6.89022787e+06 -1.01200000e+03]
[ 7.45980000e+05 6.89058852e+06 -6.08000000e+02]
[ 7.45980000e+05 6.89094654e+06 -2.04000000e+02]]","[[ 2 1 0]
[ 0 1 3]
[ 3 1 4]
...
[984 985 949]
[950 986 951]
[985 986 950]]",2,2.92
1,SimpleBIF,BIF_Series,2,False,#9f0052,"[[ 7.14994195e+05 6.88310000e+06 -2.04000000e+02]
[ 7.15380000e+05 6.88176000e+06 -3.44077087e+02]
[ 7.14682343e+05 6.88176000e+06 -2.04000000e+02]
...
[ 7.45980000e+05 6.89114000e+06 -6.54912231e+02]
[ 7.45980000e+05 6.89117842e+06 -6.08000000e+02]
[ 7.45980000e+05 6.89150733e+06 -2.04000000e+02]]","[[ 2 1 0]
[ 7.43436825e+05 6.88980000e+06 -6.08000000e+02]
[ 7.43740451e+05 6.88980000e+06 -2.04000000e+02]
[ 7.43231528e+05 6.89114000e+06 -2.04000000e+02]]","[[ 2 1 0]
[ 0 1 3]
[ 4 3 1]
...
[1223 1225 1187]
[1225 1188 1187]
[1225 1226 1188]]",3,3.1
2,SimpleMafic1,SimpleMafic_Series,1,False,#ffbe00,"[[ 6.96000000e+05 6.86836000e+06 -7.26701508e+02]
[ 6.97020000e+05 6.86918718e+06 -6.08000000e+02]
[ 6.97020000e+05 6.86836000e+06 -8.87936874e+02]
...
[ 7.43438766e+05 6.88980000e+06 -6.08000000e+02]
[ 7.43740999e+05 6.88980000e+06 -2.04000000e+02]
[ 7.43232941e+05 6.89114000e+06 -2.04000000e+02]]","[[ 2 1 0]
[2161 2152 2150]
[2152 2161 2155]
[2155 2161 2164]]",1,2.61
0,SimpleMafic2,BIF_Series,1,False,#015482,"[[ 7.14955308e+05 6.88310000e+06 -2.04000000e+02]
[ 7.15380000e+05 6.88176000e+06 -3.54262466e+02]
[ 7.14647264e+05 6.88176000e+06 -2.04000000e+02]
...
[ 7.45980000e+05 6.89114000e+06 -6.72590622e+02]
[ 7.45980000e+05 6.89119348e+06 -6.08000000e+02]
[ 7.45980000e+05 6.89152095e+06 -2.04000000e+02]]","[[ 2 1 0]
[ 0 1 3]
[ 4 3 1]
...
[2161 2152 2150]
[2152 2161 2155]
[2155 2161 2164]]",4,2.92
[1222 1224 1186]
[1224 1187 1186]
[1224 1225 1187]]",2,2.92
1,SimpleBIF,BIF_Series,2,False,#9f0052,,,3,3.1
2,SimpleMafic1,SimpleMafic_Series,1,False,#ffbe00,,,4,2.92
4,basement,Basement,1,True,#443988,,,5,2.61
Loading

0 comments on commit 872c24a

Please sign in to comment.