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

fix pylipd query #558

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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
Loading