Skip to content

Commit

Permalink
fix pylipd query (#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkjames authored May 31, 2024
1 parent b146a64 commit 32747c1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
18 changes: 8 additions & 10 deletions pyleoclim/core/geoseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,21 +461,19 @@ def map_neighbors(self, mgs, radius=3000, projection='Orthographic', proj_defaul
from pylipd.utils.dataset import load_dir
lipd = load_dir(name='Pages2k')
df = lipd.get_timeseries_essentials()
dfs = df.query("archiveType in ('tree','documents','coral','lake sediment') and paleoData_variableName not in ('year')")
dfs = df.query("archiveType in ('Wood','Documents','Coral','Lake sediment') and paleoData_variableName not in ('year')")
# place in a MultipleGeoSeries object
ts_list = []
for _, row in dfs.iterrows():
ts_list.append(pyleo.GeoSeries(time=row['time_values'],value=row['paleoData_values'],
time_name=row['time_variableName'],value_name=row['paleoData_variableName'],
time_unit=row['time_units'], value_unit=row['paleoData_units'],
lat = row['geo_meanLat'], lon = row['geo_meanLon'],
archiveType = row['archiveType'], verbose = False,
label=row['dataSetName']+'_'+row['paleoData_variableName']))
print(ts_list)
print(len(ts_list))
time_name=row['time_variableName'],value_name=row['paleoData_variableName'],
time_unit=row['time_units'], value_unit=row['paleoData_units'],
lat = row['geo_meanLat'], lon = row['geo_meanLon'],
archiveType = row['archiveType'], verbose = False,
label=row['dataSetName']+'_'+row['paleoData_variableName']))
mgs = pyleo.MultipleGeoSeries(series_list=ts_list,time_unit='years AD')
gs = ts_list[0] # extract one record as the target one
gs = ts_list[6] # extract one record as the target one
gs.map_neighbors(mgs, radius=4000)
'''
Expand Down
8 changes: 4 additions & 4 deletions pyleoclim/core/multiplegeoseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class MultipleGeoSeries(MultipleSeries):
from pylipd.utils.dataset import load_dir
lipd = load_dir(name='Pages2k')
df = lipd.get_timeseries_essentials()
dfs = df.query("archiveType in ('tree','documents','coral','lake sediment')")
dfs = df.query("archiveType in ('Wood','Documents','Coral','Lake sediment')")
# place in a MultipleGeoSeries object
ts_list = []
for _, row in dfs.iterrows():
Expand Down Expand Up @@ -235,7 +235,7 @@ def map(self, marker='archiveType', hue='archiveType', size=None, cmap=None,
from pylipd.utils.dataset import load_dir
lipd = load_dir(name='Pages2k')
df = lipd.get_timeseries_essentials()
dfs = df.query("archiveType in ('tree','documents','coral','lake sediment','borehole')")
dfs = df.query("archiveType in ('Wood','Documents','Coral','Lake sediment','Borehole')")
# place in a MultipleGeoSeries object
ts_list = []
for _, row in dfs.iterrows():
Expand Down Expand Up @@ -353,7 +353,7 @@ def pca(self, weights=None,missing='fill-em',tol_em=5e-03, max_em_iter=100,**pca
lipd = load_dir(name='Pages2k') # this loads a small subset of the PAGES 2k database
lipd_euro = lipd.filter_by_geo_bbox(-20,20,40,80)
df = lipd_euro.get_timeseries_essentials()
dfs = df.query("archiveType in ('tree') & paleoData_variableName not in ('year')")
dfs = df.query("archiveType in ('Wood') & paleoData_variableName not in ('year')")
# place in a MultipleGeoSeries object
ts_list = []
for _, row in dfs.iterrows():
Expand Down Expand Up @@ -604,7 +604,7 @@ def time_geo_plot(self, figsize=[10, 3],
from pylipd.utils.dataset import load_dir
lipd = load_dir(name='Pages2k')
df = lipd.get_timeseries_essentials()
dfs = df.query("archiveType in ('tree','documents','coral','lake sediment')")
dfs = df.query("archiveType in ('Wood','Documents','Coral','Lake sediment')")
# place in a MultipleGeoSeries object
ts_list = []
for _, row in dfs.iloc[:5].iterrows():
Expand Down

0 comments on commit 32747c1

Please sign in to comment.