Skip to content

Commit

Permalink
Merge branch 'main' into add_flash_age_compositor to avoid dask issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ClementLaplace committed Jan 20, 2025
2 parents ad90c56 + a22bf7c commit 407c609
Show file tree
Hide file tree
Showing 15 changed files with 286 additions and 244 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Bug report
about: Create a report to help us improve
type: 'bug'

---

Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
name: Feature request
about: Suggest an idea for this project
type: 'feature'

---

Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fail_fast: false
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.8.1'
rev: 'v0.8.6'
hooks:
- id: ruff
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand All @@ -19,7 +19,7 @@ repos:
- id: bandit
args: [--ini, .bandit]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.13.0' # Use the sha / tag you want to point at
rev: 'v1.14.1' # Use the sha / tag you want to point at
hooks:
- id: mypy
additional_dependencies:
Expand Down
17 changes: 0 additions & 17 deletions MANIFEST.in

This file was deleted.

2 changes: 1 addition & 1 deletion doc/source/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ If ``clip_negative_radiances=False``, pixels with negative radiances will have

Clipping of negative radiances is currently implemented for the following readers:

* ``abi_l1b``, ``ami_l1b``
* ``abi_l1b``, ``ami_l1b``, ``fci_l1c_nc``


Temporary Directory
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ build-backend = "hatchling.build"
[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.build.targets.sdist]
only-include = [
"satpy",
"doc",
"AUTHORS.md",
"CHANGELOG.md",
"SECURITY.md",
"CITATION",
]

[tool.hatch.build.targets.wheel]
packages = ["satpy"]

Expand Down
110 changes: 0 additions & 110 deletions satpy/enhancements/atmosphere.py

This file was deleted.

4 changes: 2 additions & 2 deletions satpy/etc/composites/visir.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ composites:
is still under development and may be subject to change.
compositor: !!python/name:satpy.composites.RatioCompositor
prerequisites:
- wavelength: 0.86
- wavelength: 0.905
- wavelength: 0.86
standard_name: essl_colorized_low_level_moisture

day_essl_colorized_low_level_moisture:
Expand All @@ -638,7 +638,7 @@ composites:
day_night: day_only
prerequisites:
- name: essl_colorized_low_level_moisture
standard_name: day_essl_colorized_low_level_moisture
standard_name: image_ready

rocket_plume_day:
description: >
Expand Down
114 changes: 108 additions & 6 deletions satpy/etc/enhancements/generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1243,12 +1243,114 @@ enhancements:
essl_colorized_low_level_moisture:
name: essl_colorized_low_level_moisture
operations:
- name: essl_moisture
method: !!python/name:satpy.enhancements.atmosphere.essl_moisture

day_essl_colorized_low_level_moisture:
standard_name: day_essl_colorized_low_level_moisture
operations: []
- name: colorize
method: !!python/name:satpy.enhancements.colorize
kwargs:
palettes:
- min_value: 0.625
max_value: 0.91
values:
- 0.6250
- 0.6290
- 0.6331
- 0.6372
- 0.6414
- 0.6456
- 0.6499
- 0.6542
- 0.6586
- 0.6631
- 0.6676
- 0.6722
- 0.6768
- 0.6815
- 0.6863
- 0.6911
- 0.6960
- 0.7010
- 0.7061
- 0.7112
- 0.7164
- 0.7216
- 0.7270
- 0.7324
- 0.7380
- 0.7436
- 0.7492
- 0.7550
- 0.7609
- 0.7668
- 0.7729
- 0.7790
- 0.7853
- 0.7916
- 0.7980
- 0.8046
- 0.8113
- 0.8180
- 0.8249
- 0.8319
- 0.8390
- 0.8463
- 0.8537
- 0.8612
- 0.8688
- 0.8766
- 0.8845
- 0.8925
- 0.9007
- 0.9091
colors:
- [63, 0, 47]
- [58, 0, 50]
- [53, 0, 52]
- [48, 0, 54]
- [42, 0, 56]
- [37, 0, 58]
- [32, 0, 59]
- [27, 5, 60]
- [22, 11, 61]
- [16, 17, 62]
- [11, 23, 63]
- [6, 28, 63]
- [1, 34, 63]
- [0, 40, 63]
- [0, 46, 63]
- [0, 52, 62]
- [0, 58, 62]
- [0, 64, 61]
- [0, 70, 60]
- [0, 76, 58]
- [0, 82, 57]
- [0, 88, 55]
- [0, 94, 53]
- [0, 100, 51]
- [3, 106, 49]
- [17, 112, 46]
- [31, 118, 43]
- [44, 124, 40]
- [58, 130, 37]
- [72, 136, 35]
- [86, 141, 42]
- [100, 147, 50]
- [114, 153, 58]
- [128, 159, 66]
- [142, 165, 74]
- [156, 171, 81]
- [169, 177, 89]
- [183, 183, 97]
- [197, 189, 105]
- [211, 195, 113]
- [225, 201, 120]
- [239, 207, 128]
- [253, 213, 136]
- [255, 219, 144]
- [255, 225, 152]
- [255, 231, 160]
- [255, 237, 167]
- [255, 243, 175]
- [255, 249, 183]
- [255, 255, 191]

rocket_plume:
standard_name: rocket_plume
Expand Down
15 changes: 14 additions & 1 deletion satpy/readers/fci_l1c_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
from pyorbital.astronomy import sun_earth_distance_correction
from pyresample import geometry

import satpy
from satpy.readers._geos_area import get_geos_area_naming
from satpy.readers.eum_base import get_service_mode

Expand Down Expand Up @@ -208,7 +209,8 @@ class using the :mod:`~satpy.Scene.load` method with the reader
"MTI3": "MTG-I3",
"MTI4": "MTG-I4"}

def __init__(self, filename, filename_info, filetype_info):
def __init__(self, filename, filename_info, filetype_info,
clip_negative_radiances=None, **kwargs):
"""Initialize file handler."""
super().__init__(filename, filename_info,
filetype_info,
Expand All @@ -233,6 +235,9 @@ def __init__(self, filename, filename_info, filetype_info):
else:
self.is_iqt = False

if clip_negative_radiances is None:
clip_negative_radiances = satpy.config.get("readers.clip_negative_radiances")
self.clip_negative_radiances = clip_negative_radiances
self._cache = {}

@property
Expand Down Expand Up @@ -661,6 +666,8 @@ def calibrate_counts_to_physical_quantity(self, data, key):

def calibrate_counts_to_rad(self, data, key):
"""Calibrate counts to radiances."""
if self.clip_negative_radiances:
data = self._clipneg(data)
if key["name"] == "ir_38":
data = xr.where(((2 ** 12 - 1 < data) & (data <= 2 ** 13 - 1)),
(data * data.attrs.get("warm_scale_factor", 1) +
Expand All @@ -677,6 +684,12 @@ def calibrate_counts_to_rad(self, data, key):
self.get_and_cache_npxr(measured + "/radiance_unit_conversion_coefficient")})
return data

@staticmethod
def _clipneg(data):
"""Clip counts to avoid negative radiances."""
lo = -data.attrs.get("add_offset", 0) // data.attrs.get("scale_factor", 1) + 1
return data.where((~data.notnull())|(data>=lo), lo)

def calibrate_rad_to_bt(self, radiance, key):
"""IR channel calibration."""
# using the method from PUG section Converting from Effective Radiance to Brightness Temperature for IR Channels
Expand Down
Loading

0 comments on commit 407c609

Please sign in to comment.