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

Handle valid range and valid_range correctly for two types of HY2 SCAT l2b hdf5 data #2211

Closed
Closed
Changes from 3 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
5b3ad0b
First attempt at true color FCI RGB
gerritholl Aug 16, 2022
9e719d4
Add a corrected green composite for FCI and use this
gerritholl Aug 16, 2022
06231e9
Move green corrector to new module
gerritholl Aug 16, 2022
4cf470e
Improve docs for FCI true color composite
gerritholl Aug 16, 2022
cd132f9
Add new module that was missing in previous commit
gerritholl Aug 17, 2022
be84ed4
try corrected green raw?
gerritholl Aug 18, 2022
a34de8d
Update URL to rasterio repository in CI
djhoese Sep 21, 2022
d053f22
Small fixes based on Dave feedback
gerritholl Sep 28, 2022
43d6bba
Update seadas_l2 reader to handle alternative NetCDF file format
djhoese Sep 28, 2022
6e53c6d
Fix fine/coarse area checks for 1D SwathDefinitions
djhoese Sep 28, 2022
3b1c58f
Fix VIIRS EDR Active Fires reader using bad sensor and platform attri…
djhoese Sep 28, 2022
6ec5b8c
Use the attributes of data when this has changed. Use keep_attrs=True…
Sep 28, 2022
8e667e6
Use keep_attrs=True in xarray.where
Sep 29, 2022
2fe859b
need to store attrs from data and update data.attrs after xarray.where
Sep 29, 2022
5d74a58
Fix coord renaming for AOD product in abi l2
mraspaud Sep 30, 2022
728bf8d
Fix failing get_satpos precision test
djhoese Sep 30, 2022
1e5043d
Merge pull request #2205 from djhoese/ci-update-rio-url
djhoese Sep 30, 2022
4986e53
Try not using new xarray 2022.9.0
djhoese Sep 30, 2022
1a0401c
Fix NIRReflectance test compatibility with newer xarray
djhoese Oct 2, 2022
709aeb8
Fix water detection VIIRS enhancement if dask arrays are not copied i…
djhoese Oct 3, 2022
0869948
Merge pull request #2217 from djhoese/bugfix-ci-failing-test
djhoese Oct 3, 2022
16792d3
Merge branch 'main' into fix-aod-coord-renaming
mraspaud Oct 3, 2022
753b293
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Oct 3, 2022
7a30eb8
Merge pull request #2218 from pytroll/pre-commit-ci-update-config
djhoese Oct 4, 2022
b73eb13
Merge branch 'main' into fix-aod-coord-renaming
mraspaud Oct 4, 2022
ef2c962
Merge branch 'main' into fci-true-color
gerritholl Oct 4, 2022
b9002de
Merge pull request #2216 from mraspaud/fix-aod-coord-renaming
djhoese Oct 4, 2022
a8e36d9
Fix CLAVR-x configuration in 'awips_tiled' writer to be backwards com…
djhoese Oct 4, 2022
718a27a
Remove superfluous header
gerritholl Oct 5, 2022
4baae95
Merge pull request #2181 from gerritholl/fci-true-color
mraspaud Oct 5, 2022
877f46b
Fix ICI yaml file after latest update regarding MWS and the Frequency…
Oct 5, 2022
f6fe92a
Remove parts on auxillary data that is not yet supported
Oct 5, 2022
fc652d7
Merge branch 'main' into feature-seadas-nc
djhoese Oct 5, 2022
26b1988
Merge branch 'main' into bugix-viirsfires-sensor
djhoese Oct 5, 2022
2e73421
Merge pull request #2210 from djhoese/bugix-viirsfires-sensor
mraspaud Oct 6, 2022
dbf9929
Merge pull request #2221 from adybbroe/fix-ici-after-mws-merge
mraspaud Oct 6, 2022
6d24db1
Merge pull request #2209 from djhoese/feature-seadas-nc
mraspaud Oct 6, 2022
15be5c1
Merge pull request #2220 from djhoese/bugfix-clavrx-awips-catprods
djhoese Oct 7, 2022
25740d7
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Oct 10, 2022
5cc09e0
Merge pull request #2231 from pytroll/pre-commit-ci-update-config
djhoese Oct 11, 2022
2d95747
Use the attributes of data when this has changed. Use keep_attrs=True…
Sep 28, 2022
f9fd9cd
Use keep_attrs=True in xarray.where
Sep 29, 2022
7f49a6d
need to store attrs from data and update data.attrs after xarray.where
Sep 29, 2022
2169af9
Merge branch 'issue2208-hy2-scat-l2b-h5-valid-range' of github.com:TA…
Oct 11, 2022
1461f20
test with copy of xarray datasets
Oct 11, 2022
df70a54
docstring
Oct 11, 2022
2218d68
docstring
Oct 11, 2022
a3e4f48
add properties test
Oct 11, 2022
4f269d7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 11, 2022
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
19 changes: 11 additions & 8 deletions satpy/readers/hy2_scat_l2b_h5.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ def get_dataset(self, key, info):
else:
dim_map = {curr_dim: new_dim for curr_dim, new_dim in zip(data.dims, dims)}
data = data.rename(dim_map)
data = self._mask_data(key['name'], data)
data = self._scale_data(key['name'], data)
data = self._mask_data(data)
data = self._scale_data(data)

if key['name'] in 'wvc_lon':
_attrs = data.attrs
data = xr.where(data > 180, data - 360., data)
data.attrs.update(_attrs)
data.attrs.update(info)
data.attrs.update(self.get_metadata())
data.attrs.update(self.get_variable_metadata())
Expand All @@ -120,13 +122,14 @@ def get_dataset(self, key, info):

return data

def _scale_data(self, key_name, data):
return data * self[key_name].attrs['scale_factor'] + self[key_name].attrs['add_offset']
def _scale_data(self, data):
return data * data.attrs['scale_factor'] + data.attrs['add_offset']

def _mask_data(self, key_name, data):
data = xr.where(data == self[key_name].attrs['fill_value'], np.nan, data)

valid_range = self[key_name].attrs['valid_range']
def _mask_data(self, data):
_attrs = data.attrs
valid_range = data.attrs['valid_range']
data = xr.where(data == data.attrs['fill_value'], np.nan, data)
data = xr.where(data < valid_range[0], np.nan, data)
data = xr.where(data > valid_range[1], np.nan, data)
data.attrs.update(_attrs)
return data