Skip to content

Commit

Permalink
Improve Copernicus noise screening
Browse files Browse the repository at this point in the history
  • Loading branch information
tukiains committed Sep 21, 2023
1 parent 5aa9dbc commit 6994aaf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cloudnetpy/instruments/copernicus.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def copernicus2nc(
copernicus.sort_timestamps()
copernicus.remove_duplicate_timestamps()
copernicus.calibrate_reflectivity()
copernicus.screen_by_snr(snr_limit=3)
copernicus.screen_using_top_gates_snr()
copernicus.mask_corrupted_values()
copernicus.mask_invalid_data()
copernicus.add_time_and_range()
Expand Down
10 changes: 10 additions & 0 deletions cloudnetpy/instruments/nc_radar.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ def screen_by_snr(self, snr_limit: float = -17) -> None:
if cloudnet_array.data.ndim == 2:
cloudnet_array.mask_indices(ind)

def screen_using_top_gates_snr(self, snr_limit: float = 2) -> None:
"""Masks values where SNR is smaller than mean SNR of top gates."""
n_gates = 50
snr = self.data["SNR"][:]
mean_snr = np.mean(snr[:, -n_gates:], axis=1)
for time_ind, snr_profile in enumerate(snr):
alt_ind = np.where(snr_profile < mean_snr[time_ind] + snr_limit)[0]
if len(alt_ind) > 0:
self.data["Zh"][:][time_ind, alt_ind] = ma.masked

def mask_invalid_data(self) -> None:
"""Makes sure Z and v masks are also in other 2d variables."""
z_mask = self.data["Zh"][:].mask
Expand Down

0 comments on commit 6994aaf

Please sign in to comment.