Skip to content

Commit

Permalink
some testing for cloudbase
Browse files Browse the repository at this point in the history
  • Loading branch information
Nina.Hakansson committed Oct 21, 2023
1 parent e96db81 commit e26da9d
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
1 change: 1 addition & 0 deletions satpy/composites/cloud_products.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __call__(self, projectables, **info):
data, cma = projectables
valid_cma = cma != cma.attrs['_FillValue']
valid_prod = data != data.attrs['_FillValue']
valid_prod = np.logical_and(valid_prod, valid_cma) # temporary for cloudbase
valid_prod = np.logical_and(valid_prod, np.logical_not(np.isnan(data)))
# Update valid_cma and not valid_prod means: keep not valid cma or valid prod
data = data.where(np.logical_or(np.logical_not(valid_cma), valid_prod),
Expand Down
7 changes: 5 additions & 2 deletions satpy/enhancements/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,15 @@ def _merge_colormaps(kwargs, img=None):
if isinstance(palette, Colormap):
full_cmap = palette
else:
full_cmap = create_colormap(palette, img)
"""
for itm in palette:
cmap = create_colormap(itm, img)
if full_cmap is None:
full_cmap = cmap
else:
full_cmap = full_cmap + cmap

"""
return full_cmap


Expand Down Expand Up @@ -457,12 +459,13 @@ def create_colormap(palette, img=None):
information.
"""

fname = palette.get('filename', None)
colors = palette.get('colors', None)
dataset = palette.get("dataset", None)
# are colors between 0-255 or 0-1
color_scale = palette.get('color_scale', 255)
if fname:
if fname is not None:
if not os.path.exists(fname):
fname = get_config_path(fname)
cmap = Colormap.from_file(fname, palette.get("colormap_mode", None), color_scale)
Expand Down
7 changes: 7 additions & 0 deletions satpy/etc/composites/visir.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,13 @@ composites:
- cma
standard_name: pps_cma

pps_cbase:
compositor: !!python/name:satpy.composites.cloud_products.CloudCompositorCommonMask
prerequisites:
- nncbase
- cma
standard_name: pps_cbase

pps_ct:
compositor: !!python/name:satpy.composites.cloud_products.CloudCompositorCommonMask
prerequisites:
Expand Down
29 changes: 29 additions & 0 deletions satpy/etc/enhancements/generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,35 @@ enhancements:
- dataset: cma_pal
color_scale: 255

pps_cbase:
standard_name: pps_cbase
operations:
- name: colorize
method: !!python/name:satpy.enhancements.colorize
kwargs:
palettes: {
values: [0, 679, 680, 720, 760, 800, 840, 880, 920, 960, 990, 991, 1049, 1050, 1200],
colors: [
[100.0, 100, 100],
[150, 150, 150],
[255, 247, 236.0],
[254, 232, 200],
[253, 212, 158],
[253, 187, 132],
[252, 141, 89],
[239, 101, 72],
[215, 48, 31],
[179, 0, 0],
[127, 0, 0],
[120, 0.0, 50],
[120, 0.0, 50],
[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0],
],
color_scale: 255,
min_value: 0,
max_value: 1200}

pps_ct:
standard_name: pps_ct
operations:
Expand Down
9 changes: 9 additions & 0 deletions satpy/etc/readers/nwcsaf-pps_nc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ file_types:
'W_XX-EUMETSAT-Darmstadt,SING+LEV+SAT,{platform_id}+CTTH_C_EUMS_{start_time:%Y%m%d%H%M%S}_{orbit_number}.nc',
'W_XX-EUMETSAT-Darmstadt,SING+LEV+SAT,{platform_id}+CTTH_C_EUMS_{start_time:%Y%m%d%H%M%S}_{orbit_number}.nc.bz2']

nc_nwcsaf_nnextra:
file_reader: !!python/name:satpy.readers.nwcsaf_nc.NcNWCSAF
file_patterns: ['S_NWC_nnextra_{platform_id}_{orbit_number}_{start_time:%Y%m%dT%H%M%S%f}Z_{end_time:%Y%m%dT%H%M%S%f}Z.nc']

nc_nwcsaf_pc:
file_reader: !!python/name:satpy.readers.nwcsaf_nc.NcNWCSAF
file_patterns: ['S_NWC_PC_{platform_id}_{orbit_number}_{start_time:%Y%m%dT%H%M%S%f}Z_{end_time:%Y%m%dT%H%M%S%f}Z.nc']
Expand Down Expand Up @@ -242,6 +246,11 @@ datasets:
scale_offset_dataset: ctth_tempe
file_type: nc_nwcsaf_ctth

nncbase:
name: nncbase
file_type: nc_nwcsaf_nnextra
coordinates: [lon, lat]


# ---- CMIC products (Was CPP in PPS<=2018)------------

Expand Down

0 comments on commit e26da9d

Please sign in to comment.