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

Improve the SAR-C reading and Ice composite #557

Merged
merged 21 commits into from
Mar 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7fff643
Make the sar-ice composite more stable and better at showing ice
mraspaud Dec 20, 2018
883bfec
Add support for SAR-C azimuth noise removal
mraspaud Dec 20, 2018
174f42b
Switch SAR-C reading to using rasterio and pass GCPs
mraspaud Dec 20, 2018
889f80a
Remove unneeded comment
mraspaud Dec 20, 2018
5e91f6e
Add sar-ice-legacy and sar-land composites
mraspaud Dec 20, 2018
76a9630
Deactivate sharing of filehandles for sar-c reading
mraspaud Dec 21, 2018
d51d6d7
Thread-lock when reading sar-c data
mraspaud Dec 21, 2018
c5f35e6
Lock sar reading at filehandler instance level
mraspaud Dec 21, 2018
300fa4a
Add calibration levels to SAR-C data reading and compositing
mraspaud Jan 8, 2019
8e930f0
Merge branch 'master' into feature-sar-gcps
mraspaud Jan 9, 2019
59650a7
Merge branch 'master' into feature-sar-gcps
mraspaud Jan 9, 2019
7514ec0
Add function to read SAR data using native blocks
mraspaud Jan 14, 2019
9a05fa6
Use better chunking for reading sar data
mraspaud Jan 29, 2019
1e3c220
Split crs and gcps in SAR reader
mraspaud Feb 27, 2019
d7f61b1
Merge branch 'master' into feature-sar-gcps
mraspaud Feb 27, 2019
018b2a6
Add tests for the sar-c SAFE reader
mraspaud Mar 4, 2019
449f941
Rename SAR-C SAFE test file
mraspaud Mar 4, 2019
2f77509
Fix sar reader tests
mraspaud Mar 4, 2019
4c94fcd
Add documentation to the SAR-C reader
mraspaud Mar 5, 2019
3897d28
Fix doc formatting in goes nc reader
mraspaud Mar 5, 2019
c9b78c5
Remove the use of xu for sar compositing
mraspaud Mar 8, 2019
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
3 changes: 3 additions & 0 deletions satpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
'reflectance',
'radiance',
'counts',
'gamma',
'sigma_nought',
'beta_nought',
]
CALIBRATION_ORDER = os.getenv('PYTROLL_CALIBRATION_ORDER', None)
if CALIBRATION_ORDER is None:
Expand Down
31 changes: 25 additions & 6 deletions satpy/composites/sar.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,23 @@

import logging

import xarray.ufuncs as xu
import numpy as np
from satpy.composites import GenericCompositor
from satpy.dataset import combine_metadata

LOG = logging.getLogger(__name__)


def overlay(top, bottom):
def overlay(top, bottom, maxval=None):
"""Blending two layers.

from: https://docs.gimp.org/en/gimp-concepts-layer-modes.html
"""
maxval = xu.maximum(top.max(), bottom.max())
if maxval is None:
maxval = np.maximum(top.max(), bottom.max())

res = ((2 * top / maxval - 1) * bottom + 2 * top) * bottom / maxval

return res
return res.clip(min=0)


class SARIce(GenericCompositor):
Expand All @@ -49,12 +49,31 @@ class SARIce(GenericCompositor):
def __call__(self, projectables, *args, **kwargs):
"""Create the SAR Ice composite."""
(mhh, mhv) = projectables
green = overlay(mhh, mhv)
ch1attrs = mhh.attrs
ch2attrs = mhv.attrs
mhh = np.sqrt(mhh ** 2 + 0.002) - 0.04
mhv = np.sqrt(mhv ** 2 + 0.002) - 0.04
mhh.attrs = ch1attrs
mhv.attrs = ch2attrs
green = overlay(mhh, mhv, 30) * 1000
green.attrs = combine_metadata(mhh, mhv)

return super(SARIce, self).__call__((mhv, green, mhh), *args, **kwargs)


class SARIceLegacy(GenericCompositor):
"""The SAR Ice composite, legacy version with dynamic stretching."""

def __call__(self, projectables, *args, **kwargs):
"""Create the SAR RGB composite."""

(mhh, mhv) = projectables
green = overlay(mhh, mhv)
green.attrs = combine_metadata(mhh, mhv)

return super(SARIceLegacy, self).__call__((mhv, green, mhh), *args, **kwargs)


class SARRGB(GenericCompositor):
"""The SAR RGB composite."""

Expand Down
22 changes: 22 additions & 0 deletions satpy/etc/composites/sar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ composites:
prerequisites:
- name: measurement
polarization: hh
calibration: gamma
- name: measurement
polarization: hv
calibraion: gamma
standard_name: sar-ice

sar-ice-iw:
compositor: !!python/name:satpy.composites.sar.SARIce
prerequisites:
- name: measurement
polarization: vv
calibration: gamma
- name: measurement
polarization: vh
calibration: gamma
standard_name: sar-ice

sar-rgb:
Expand All @@ -36,3 +40,21 @@ composites:
- name: measurement
polarization: hv
standard_name: sar-quick

sar-ice-legacy:
compositor: !!python/name:satpy.composites.sar.SARIceLegacy
prerequisites:
- name: measurement
polarization: hh
- name: measurement
polarization: hv
standard_name: sar-ice-legacy

sar-land:
compositor: !!python/name:satpy.composites.sar.SARIce
prerequisites:
- name: measurement
polarization: hh
- name: measurement
polarization: hv
standard_name: sar-land
29 changes: 29 additions & 0 deletions satpy/etc/enhancements/generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,21 @@ enhancements:
sar-ice:
standard_name: sar-ice
operations:
- name: stretch
method: *stretchfun
kwargs:
stretch: crude
min_stretch: [0, 0, 0]
max_stretch: [0.10, 1.37, 0.32 ]

- name: gamma
method: *gammafun
kwargs:
gamma: [2, 3, 2]

sar-ice-legacy:
standard_name: sar-ice-legacy
operations:
- name: stretch
method: *stretchfun
kwargs:
Expand All @@ -232,6 +247,20 @@ enhancements:
kwargs:
gamma: [1, 1.2, 1]

sar-land:
standard_name: sar-land
operations:
- name: stretch
method: *stretchfun
kwargs:
stretch: crude
min_stretch: [0.01, 1. , 0.15 ]
max_stretch: [0.765, 50., 1.4]
- name: gamma
method: *gammafun
kwargs:
gamma: [1.5, 2.25, 1.5]

sar-rgb:
standard_name: sar-rgb
operations:
Expand Down
18 changes: 10 additions & 8 deletions satpy/etc/readers/sar-c_safe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,16 @@ datasets:
wavelength: [5.400, 5.405, 5.410]
resolution: 80
polarization: [hh, hv, vv, vh]
# navigation: esa_geo
# calibration:
# radiance:
# standard_name: toa_outgoing_radiance_per_unit_wavelength
# units: W m-2 um-1 sr-1
# reflectance:
# standard_name: toa_bidirectional_reflectance
# units: "%"
calibration:
gamma:
standard_name: backscatter
units: 1
sigma_nought:
standard_name: backscatter
units: 1
beta_nought:
standard_name: backscatter
units: 1
coordinates: [longitude, latitude]
file_type: safe_measurement

Expand Down
172 changes: 102 additions & 70 deletions satpy/readers/goes_imager_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,91 +66,123 @@
maximum calibration coefficients and computing the difference. The maximum
differences are:

======= ===== ====
GOES-8
======
00_7 0.0 % # Counts are normalized
03_9 0.187 K
06_8 0.0 K # only one detector
10_7 0.106 K
12_0 0.036 K

------------------
Channel Diff Unit
======= ===== ====
00_7 0.0 % # Counts are normalized
03_9 0.187 K
06_8 0.0 K # only one detector
10_7 0.106 K
12_0 0.036 K
======= ===== ====

======= ===== ====
GOES-9
========
00_7 0.0 % # Counts are normalized
03_9 0.0 K # coefs identical
06_8 0.0 K # only one detector
10_7 0.021 K
12_0 0.006 K

------------------
Channel Diff Unit
======= ===== ====
00_7 0.0 % # Counts are normalized
03_9 0.0 K # coefs identical
06_8 0.0 K # only one detector
10_7 0.021 K
12_0 0.006 K
======= ===== ====

======= ===== ====
GOES-10
========
00_7 1.05 %
03_9 0.0 K # coefs identical
06_8 0.0 K # only one detector
10_7 0.013 K
12_0 0.004 K

------------------
Channel Diff Unit
======= ===== ====
00_7 1.05 %
03_9 0.0 K # coefs identical
06_8 0.0 K # only one detector
10_7 0.013 K
12_0 0.004 K
======= ===== ====

======= ===== ====
GOES-11
========
00_7 1.25 %
03_9 0.0 K # coefs identical
06_8 0.0 K # only one detector
10_7 0.0 K # coefs identical
12_0 0.065 K

------------------
Channel Diff Unit
======= ===== ====
00_7 1.25 %
03_9 0.0 K # coefs identical
06_8 0.0 K # only one detector
10_7 0.0 K # coefs identical
12_0 0.065 K
======= ===== ====

======= ===== ====
GOES-12
========
00_7 0.8 %
03_9 0.0 K # coefs identical
06_5 0.044 K
10_7 0.0 K # coefs identical
13_3 0.0 K # only one detector

------------------
Channel Diff Unit
======= ===== ====
00_7 0.8 %
03_9 0.0 K # coefs identical
06_5 0.044 K
10_7 0.0 K # coefs identical
13_3 0.0 K # only one detector
======= ===== ====

======= ===== ====
GOES-13
========
00_7 1.31 %
03_9 0.0 K # coefs identical
06_5 0.085 K
10_7 0.008 K
13_3 0.0 K # only one detector

------------------
Channel Diff Unit
======= ===== ====
00_7 1.31 %
03_9 0.0 K # coefs identical
06_5 0.085 K
10_7 0.008 K
13_3 0.0 K # only one detector
======= ===== ====

======= ===== ====
GOES-14
========
00_7 0.66 %
03_9 0.0 K # coefs identical
06_5 0.043 K
10_7 0.006 K
13_3 0.003 K

------------------
Channel Diff Unit
======= ===== ====
00_7 0.66 %
03_9 0.0 K # coefs identical
06_5 0.043 K
10_7 0.006 K
13_3 0.003 K
======= ===== ====

======= ===== ====
GOES-15
========
00_7 0.86 %
03_9 0.0 K # coefs identical
06_5 0.02 K
10_7 0.009 K
13_3 0.008 K

------------------
Channel Diff Unit
======= ===== ====
00_7 0.86 %
03_9 0.0 K # coefs identical
06_5 0.02 K
10_7 0.009 K
13_3 0.008 K
======= ===== ====

References:

[GVAR] https://goes.gsfc.nasa.gov/text/GVARRDL98.pdf
[BOOK-N] https://goes.gsfc.nasa.gov/text/GOES-N_Databook/databook.pdf
[BOOK-I] https://goes.gsfc.nasa.gov/text/databook/databook.pdf
[IR] https://www.ospo.noaa.gov/Operations/GOES/calibration/gvar-conversion.html
[VIS] https://www.ospo.noaa.gov/Operations/GOES/calibration/goes-vis-ch-calibration.html
[FAQ] https://www.ncdc.noaa.gov/sites/default/files/attachments/Satellite-Frequently-Asked-Questions_2.pdf
[SCHED-W] http://www.ospo.noaa.gov/Operations/GOES/west/imager-routine.html
[SCHED-E] http://www.ospo.noaa.gov/Operations/GOES/east/imager-routine.html
- [GVAR] https://goes.gsfc.nasa.gov/text/GVARRDL98.pdf
- [BOOK-N] https://goes.gsfc.nasa.gov/text/GOES-N_Databook/databook.pdf
- [BOOK-I] https://goes.gsfc.nasa.gov/text/databook/databook.pdf
- [IR] https://www.ospo.noaa.gov/Operations/GOES/calibration/gvar-conversion.html
- [VIS] https://www.ospo.noaa.gov/Operations/GOES/calibration/goes-vis-ch-calibration.html
- [FAQ] https://www.ncdc.noaa.gov/sites/default/files/attachments/Satellite-Frequently-Asked-Questions_2.pdf
- [SCHED-W] http://www.ospo.noaa.gov/Operations/GOES/west/imager-routine.html
- [SCHED-E] http://www.ospo.noaa.gov/Operations/GOES/east/imager-routine.html

Eumetsat formated netCDF data:

The main differences are:
1: The geolocation is in a separate file, used for all bands
2: VIS data is calibrated to Albedo (or reflectance)
3: IR data is calibrated to radiance.
4: VIS data is downsampled to IR resolution (4km)
5: File name differs also slightly
6: Data is received via EumetCast

1. The geolocation is in a separate file, used for all bands
2. VIS data is calibrated to Albedo (or reflectance)
3. IR data is calibrated to radiance.
4. VIS data is downsampled to IR resolution (4km)
5. File name differs also slightly
6. Data is received via EumetCast

"""

Expand Down
Loading