Skip to content
Commits on Source (5)
exclude: '^$'
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings, flake8-debugger, flake8-bugbear]
## Version <RELEASE_VERSION> (2019/10/03)
### Pull Requests Merged
#### Bugs fixed
* [PR 85](https://github.com/pytroll/pyspectral/pull/85) - Fix doc tests for r37 derivations
* [PR 84](https://github.com/pytroll/pyspectral/pull/84) - Add AMI channel aliases from Satpy
In this release 2 pull requests were closed.
## Version <RELEASE_VERSION> (2019/09/30)
### Issues Closed
### Pull Requests Merged
#### Features added
* [PR 83](https://github.com/pytroll/pyspectral/pull/83) - Fix for appveyor, using Daves custom branch&fork of ci-helpers
* [PR 82](https://github.com/pytroll/pyspectral/pull/82) - Add support for AMI on GEO-KOMPSAT-2A
In this release 2 pull requests were closed.
## Version <RELEASE_VERSION> (2019/08/30)
### Issues Closed
......
pyspectral (0.9.0+ds-2) UNRELEASED; urgency=medium
pyspectral (0.9.2+ds-2) unstable; urgency=medium
* New upstream release.
* Bump Standards-Version to 4.4.1, no changes.
* debian/control:
- explicitly specify Rules-Requires-Root: no
-- Antonio Valentino <antonio.valentino@tiscali.it> Mon, 30 Sep 2019 19:49:20 +0200
-- Antonio Valentino <antonio.valentino@tiscali.it> Fri, 04 Oct 2019 05:21:28 +0000
pyspectral (0.9.0+ds-1) unstable; urgency=medium
......
......@@ -3,6 +3,7 @@ Maintainer: Debian GIS Project <pkg-grass-devel@lists.alioth.debian.org>
Uploaders: Antonio Valentino <antonio.valentino@tiscali.it>
Section: python
Testsuite: autopkgtest-pkg-python
Rules-Requires-Root: no
Priority: optional
Build-Depends: debhelper-compat (= 12),
dh-python,
......
......@@ -199,8 +199,8 @@ In Python this becomes:
>>> m12r = refl_m12.reflectance_from_tbs(sunz, tb37, tb11)
>>> print(np.any(np.isnan(m12r)))
False
>>> print([np.round(refl, 7) for refl in m12r])
[0.2143293, 0.2028515, 0.1706398, 0.054089, 0.0083811]
>>> print([np.round(refl, 6) for refl in m12r])
[0.214329, 0.202852, 0.17064, 0.054089, 0.008381]
We can try decompose equation :eq:`refl37` above using the example of VIIRS M12 band:
......@@ -255,5 +255,6 @@ Using the example of the VIIRS M12 band from above this gives the following spec
>>> ['{tb:6.3f}'.format(tb=np.round(t, 4)) for t in tb]
['266.996', '267.262', '267.991', '271.033', '271.927']
>>> rad = refl_m12.emissive_part_3x(tb=False)
>>> ['{rad:6.3f}'.format(rad=np.round(r, 3)) for r in rad.compute()]
['80285.150', '81458.022', '84749.638', '99761.401', '104582.031']
>>> ['{rad:6.1f}'.format(rad=np.round(r, 1)) for r in rad.compute()]
['80285.2', '81458.0', '84749.7', '99761.4', '104582.0']
......@@ -31,6 +31,12 @@ have been included in PySpectral.
* - Himawari-9 ahi
- `rsr_ahi_Himawari-9.h5`
- JMA_
* - GEO-KOMPSAT-2A ami
- `rsr_ami_GEO-KOMPSAT-2A.h5`
- NWPSAF-GeoKompsat-2A-ami_
* - FY-4A agri
- `rsr_agri_FY-4A.h5`
- NSMC-fy4a_
* - Envisat aatsr
- `rsr_aatsr_Envisat.h5`
- ESA-Envisat_
......@@ -95,4 +101,5 @@ have been included in PySpectral.
.. _NESDIS: https://ncc.nesdis.noaa.gov/J1VIIRS/J1VIIRSSpectralResponseFunctions.php
.. _CMA: http://www.cma.gov.cn/en2014/
.. _NWPSAF-MetImage: https://nwpsaf.eu/downloads/rtcoef_rttov12/ir_srf/rtcoef_metopsg_1_metimage_srf.html
.. _NWPSAF-GeoKompsat-2A-ami: https://nwpsaf.eu/downloads/rtcoef_rttov12/ir_srf/rtcoef_gkompsat2_1_ami_srf.html
.. _NSMC-fy4a: http://fy4.nsmc.org.cn/portal/cn/fycv/srf.html
......@@ -110,6 +110,24 @@ BANDNAMES['ahi'] = {'B01': 'ch1',
'B16': 'ch16'
}
BANDNAMES['ami'] = {'VI004': 'ch1',
'VI005': 'ch2',
'VI006': 'ch3',
'VI008': 'ch4',
'NR013': 'ch5',
'NR016': 'ch6',
'SW038': 'ch7',
'WV063': 'ch8',
'WV069': 'ch9',
'WV073': 'ch10',
'IR087': 'ch11',
'IR096': 'ch12',
'IR105': 'ch13',
'IR112': 'ch14',
'IR123': 'ch15',
'IR133': 'ch16'
}
INSTRUMENTS = {'NOAA-19': 'avhrr/3',
'NOAA-18': 'avhrr/3',
'NOAA-17': 'avhrr/3',
......@@ -133,13 +151,14 @@ INSTRUMENTS = {'NOAA-19': 'avhrr/3',
'FY-3C': 'virr',
'FY-3B': 'virr',
'Feng-Yun 3D': 'mersi-2',
'FY-4A': 'agri'
'FY-4A': 'agri',
'GEO-KOMPSAT-2A': 'ami'
}
HTTP_PYSPECTRAL_RSR = "https://zenodo.org/record/3381130/files/pyspectral_rsr_data.tgz"
HTTP_PYSPECTRAL_RSR = "https://zenodo.org/record/3461164/files/pyspectral_rsr_data.tgz"
RSR_DATA_VERSION_FILENAME = "PYSPECTRAL_RSR_VERSION"
RSR_DATA_VERSION = "v1.0.9"
RSR_DATA_VERSION = "v1.0.10"
ATM_CORRECTION_LUT_VERSION = {}
ATM_CORRECTION_LUT_VERSION['antarctic_aerosol'] = {'version': 'v1.0.1',
......
......@@ -46,9 +46,9 @@ def get_keywords():
# setup.py/versioneer.py will grep for the variable names, so they must
# each be defined on a line of their own. _version.py will just call
# get_keywords().
git_refnames = " (HEAD -> master, tag: v0.9.0)"
git_full = "2372396547ecace7fbcefc50d5dcbaa32e4a5177"
git_date = "2019-08-30 18:04:19 +0200"
git_refnames = " (HEAD -> master, tag: v0.9.2)"
git_full = "46441255c47db317c4376aad0b753b7593fcb98f"
git_date = "2019-10-03 23:26:19 +0200"
keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
return keywords
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2019 Pytroll
# Author(s):
# Adam.Dybbroe <adam.dybbroe@smhi.se>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""Read the Geo-Kompsat-2a AMI spectral response functions. Data from the NWPSAF:
https://nwpsaf.eu/downloads/rtcoef_rttov12/ir_srf/rtcoef_gkompsat2_1_ami_srf.html
"""
import os
import numpy as np
from pyspectral.utils import convert2hdf5 as tohdf5
from pyspectral.raw_reader import InstrumentRSR
import logging
LOG = logging.getLogger(__name__)
AMI_BAND_NAMES = ['ch1', 'ch2', 'ch3', 'ch4', 'ch5',
'ch6', 'ch7', 'ch8', 'ch9', 'ch10',
'ch11', 'ch12', 'ch13', 'ch14', 'ch15',
'ch16']
#: Default time format
_DEFAULT_TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
#: Default log format
_DEFAULT_LOG_FORMAT = '[%(levelname)s: %(asctime)s : %(name)s] %(message)s'
class AmiRSR(InstrumentRSR):
"""Container for the Geo-Kompsat-2A AMI relative spectral response data"""
def __init__(self, bandname, platform_name):
super(AmiRSR, self).__init__(
bandname, platform_name, AMI_BAND_NAMES)
self.instrument = 'ami'
self._get_options_from_config()
self._get_bandfilenames()
LOG.debug("Filenames: %s", str(self.filenames))
if self.filenames[bandname] and os.path.exists(self.filenames[bandname]):
self.requested_band_filename = self.filenames[bandname]
self._load()
else:
LOG.warning("Couldn't find an existing file for this band: %s",
str(self.bandname))
# To be compatible with VIIRS....
self.filename = self.requested_band_filename
self.unit = 'micrometer'
self.wavespace = 'wavelength'
def _load(self, scale=10000.0):
"""Load the AMI RSR data for the band requested"""
data = np.genfromtxt(self.requested_band_filename,
unpack=True,
names=['wavenumber',
'response'],
skip_header=4)
# Data are wavenumbers in cm-1:
wavelength = 1. / data['wavenumber'] * scale
response = data['response']
# The real AMI has more than one detectors I assume. However, for now
# we store the single rsr available in the NWPSAF coefficient files:
self.rsr = {'wavelength': wavelength, 'response': response}
def main():
"""Main"""
for platform_name in ['GEO-KOMPSAT-2A', ]:
tohdf5(AmiRSR, platform_name, AMI_BAND_NAMES)
if __name__ == "__main__":
import sys
LOG = logging.getLogger('ami_rsr')
handler = logging.StreamHandler(sys.stderr)
formatter = logging.Formatter(fmt=_DEFAULT_LOG_FORMAT,
datefmt=_DEFAULT_TIME_FORMAT)
handler.setFormatter(formatter)
handler.setLevel(logging.DEBUG)
LOG.setLevel(logging.DEBUG)
LOG.addHandler(handler)
main()