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

Issue #128 - rename site and campaign #163

Merged
merged 1 commit into from
Oct 23, 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
10 changes: 5 additions & 5 deletions snowexsql/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def extend_qry(cls, qry, check_size=True, **kwargs):
qry = cls._filter_instrument(qry, v)
elif k == "campaign":
qry = cls._filter_campaign(qry, v)
elif k == "site_id":
elif k == "site":
qry = qry.filter(
qry_model.site.has(name=v)
)
Expand Down Expand Up @@ -321,7 +321,7 @@ def from_area(cls, shp=None, pt=None, buffer=None, crs=26912, **kwargs):
return df

@property
def all_site_names(self):
def all_campaigns(self):
"""
Return all campaign names
"""
Expand Down Expand Up @@ -477,8 +477,8 @@ class LayerMeasurements(BaseDataset):
"""
MODEL = LayerData
ALLOWED_QRY_KWARGS = [
"campaign", "site_id", "date", "instrument", "observer", "type",
"utm_zone", "pit_id", "date_greater_equal", "date_less_equal",
"campaign", "site", "date", "instrument", "observer", "type",
"utm_zone", "date_greater_equal", "date_less_equal",
"doi", "value_greater_equal", 'value_less_equal'
]

Expand All @@ -496,7 +496,7 @@ def _filter_observers(cls, qry, v):
return qry

@property
def all_site_ids(self):
def all_sites(self):
"""
Return all specific site names
"""
Expand Down
10 changes: 5 additions & 5 deletions tests/api/test_layer_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ def test_all_types(self, clz):
result = clz().all_types
assert result == ["density"]

def test_all_site_names(self, clz):
result = clz().all_site_names
def test_all_campaigns(self, clz):
result = clz().all_campaigns
assert result == ['Grand Mesa']

def test_all_site_ids(self, clz):
result = clz().all_site_ids
def test_all_sites(self, clz):
result = clz().all_sites
assert result == ['Fakepit1']

def test_all_dates(self, clz):
Expand All @@ -42,7 +42,7 @@ def test_all_instruments(self, clz):
"kwargs, expected_length, mean_value", [
({
"date": date(2020, 3, 12), "type": "density",
"pit_id": "COERIB_20200312_0938"
"site": "COERIB_20200312_0938"
}, 0, np.nan), # filter to 1 pit
({"instrument": "IRIS", "limit": 10}, 0, np.nan), # limit works
({
Expand Down
4 changes: 2 additions & 2 deletions tests/api/test_point_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def test_all_types(self):
for record in self.db_data
]

def test_all_site_names(self):
result = self.subject.all_site_names
def test_all_campaigns(self):
result = self.subject.all_campaigns
assert result == [
record.observation.campaign.name
for record in self.db_data
Expand Down