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

AMAROC-841 exclude instead of keep ceilos #140

Merged
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
6 changes: 3 additions & 3 deletions docs/source/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ you still want to use as many ceilometers as possible to infer the amount.
- If you use different ceilometer models and know that you want to calculate the
height only from hits of a specific ceilometer model to avoid implementing
complicated correction factors.
To this end, the parameter ``CEILOS_FOR_BASE_HEIGHT_CALC`` was implemented in
To this end, the parameter ``EXCLUDE_FOR_BASE_HEIGHT_CALC`` was implemented in
this version. The default value is an empty list. In order to activate the
filtering, it is sufficient to enter the ceilometer IDs of the ceilos to keep
for the base height calculation.
filtering, it is sufficient to enter the ceilometer IDs of the ceilos to exclude
from the base height calculation.
4 changes: 2 additions & 2 deletions src/ampycloud/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,9 @@ def _calculate_sligrolay_base_height(
for ind, cid in enumerate(cluster_ids):
# Which hits are in this sli/gro/lay ?
in_sligrolay = self.data[which[:-1]+'_id'] == cid
if self.prms['CEILOS_FOR_BASE_HEIGHT_CALC'] != []:
if self.prms['EXCLUDE_FOR_BASE_HEIGHT_CALC'] != []:
in_sligrolay_filtered = in_sligrolay * self.data['ceilo'].apply(
lambda x: x in self.prms['CEILOS_FOR_BASE_HEIGHT_CALC']
lambda x: x not in self.prms['EXCLUDE_FOR_BASE_HEIGHT_CALC']
)
# We require a minimum of hits by the filtered ceilos that belong to the layer
# of interest. Otherwise fall back to using all ceilos for the calculation.
Expand Down
8 changes: 4 additions & 4 deletions src/ampycloud/prms/ampycloud_default_prms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ BASE_LVL_HEIGHT_PERC: 5
# Set to 100 to use all the points.
BASE_LVL_LOOKBACK_PERC: 100

# If ceilo Ids are set, for any given layer/ group/ slice, only ceilos with the corresponding ID
# will be used for base height calculation. If the selection results in an empty layer/ group/
# If ceilo Ids are set, for any given layer/ group/ slice, ceilos with the corresponding ID
# will be excluded from the base height calculation. If the selection results in an empty layer/ group/
# slice, we go back to using all ceilo hits and ignore the selection. Use this switch if you want
# to localize the height caclulation or if you only want ceilometers from a specific type in the
# to localize the height caclulation or if you want to exclude ceilometers of a specific type in the
# height calculation.
CEILOS_FOR_BASE_HEIGHT_CALC: []
EXCLUDE_FOR_BASE_HEIGHT_CALC: []

# LOWESS parameters used to fit Slice/Groups/Layers height trends
LOWESS:
Expand Down
4 changes: 2 additions & 2 deletions test/ampycloud/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def test_localized_base_height_calculation():

mock_layer = _mock_layer_from_two_ceilos_with_narrow_stds_and_close_hits(100, 200)
chunk_filtered = CeiloChunk(
mock_layer, prms={'CEILOS_FOR_BASE_HEIGHT_CALC': 'ceilo1'}
mock_layer, prms={'EXCLUDE_FOR_BASE_HEIGHT_CALC': 'ceilo2'}
)
chunk_filtered.find_slices()
chunk_filtered.find_groups()
Expand All @@ -461,7 +461,7 @@ def test_localized_base_hgt_calc_fallback():

mock_layer = _mock_layer_from_two_ceilos_with_narrow_stds_and_close_hits(2, 200)
chunk_filtered = CeiloChunk(
mock_layer, prms={'CEILOS_FOR_BASE_HEIGHT_CALC': 'ceilo1'}
mock_layer, prms={'EXCLUDE_FOR_BASE_HEIGHT_CALC': 'ceilo2'}
)
chunk_filtered.find_slices()
chunk_filtered.find_groups()
Expand Down
Loading