Skip to content
Commits on Source (10)
[bumpversion]
current_version = 1.1.0
commit = True
tag = True
[bumpversion:file:pygac/version.py]
......@@ -5,3 +5,5 @@ doc/build
*~
dist
pygac.egg-info
etc/*.cfg
gapfilled_tles/
......@@ -7,7 +7,7 @@ install:
- pip install .
- pip install coveralls
# command to run tests, e.g. python setup.py test
env: PYGAC_CONFIG_FILE=bla
env: PYGAC_CONFIG_FILE=etc/pygac.cfg.template
script: coverage run --source=pygac setup.py test
before_install:
- sudo apt-get install -qq python-numpy python-h5py python-scipy libhdf5-serial-dev
......
## Version 1.1.0 (2019/06/12)
### Issues Closed
* [Issue 23](https://github.com/pytroll/pygac/issues/23) - Add support for Python3
* [Issue 20](https://github.com/pytroll/pygac/issues/20) - IndexError if orbit time beyond TLE range ([PR 21](https://github.com/pytroll/pygac/pull/21))
* [Issue 18](https://github.com/pytroll/pygac/issues/18) - Error in pygac data zenith angle
* [Issue 16](https://github.com/pytroll/pygac/issues/16) - Unit test failure
In this release 4 issues were closed.
### Pull Requests Merged
#### Bugs fixed
* [PR 27](https://github.com/pytroll/pygac/pull/27) - Add get_times to angles computation
* [PR 24](https://github.com/pytroll/pygac/pull/24) - Fix unit tests
* [PR 21](https://github.com/pytroll/pygac/pull/21) - Fix TLE line identification ([20](https://github.com/pytroll/pygac/issues/20))
* [PR 17](https://github.com/pytroll/pygac/pull/17) - Python 3 compatibiity
* [PR 15](https://github.com/pytroll/pygac/pull/15) - Fix selection of user defined scanlines #2
* [PR 14](https://github.com/pytroll/pygac/pull/14) - Fix gac-run
* [PR 9](https://github.com/pytroll/pygac/pull/9) - Fixes: Dependency and docs
* [PR 3](https://github.com/pytroll/pygac/pull/3) - Feature clock fixed nan tsm scanline timestamp
#### Features added
* [PR 28](https://github.com/pytroll/pygac/pull/28) - Simplify TLE computation
* [PR 26](https://github.com/pytroll/pygac/pull/26) - Python-3 Compatibility
* [PR 25](https://github.com/pytroll/pygac/pull/25) - Fix style
* [PR 19](https://github.com/pytroll/pygac/pull/19) - Add support for TIROS-N
* [PR 13](https://github.com/pytroll/pygac/pull/13) - Update installation.rst with TLE files
* [PR 11](https://github.com/pytroll/pygac/pull/11) - Add scanline timestamps to qualflags file
* [PR 10](https://github.com/pytroll/pygac/pull/10) - Usability improvements
* [PR 6](https://github.com/pytroll/pygac/pull/6) - Add new attributes to /how
* [PR 4](https://github.com/pytroll/pygac/pull/4) - Improve interface of gac_run.py
In this release 17 pull requests were closed.
include etc/*
include testdata/*
include gapfilled_tles/*
include pygac/*.pyx
include bin/pygac-*
......@@ -2,12 +2,11 @@ pygac
=====
[![Build Status](https://travis-ci.org/adybbroe/pygac.png?branch=feature-clock)](https://travis-ci.org/adybbroe/pygac)
[![Coverage Status](https://coveralls.io/repos/adybbroe/pygac/badge.png?branch=feature-clock)](https://coveralls.io/r/adybbroe/pygac?branch=feature-clock)
[![Code Health](https://landscape.io/github/adybbroe/pygac/pre-master/landscape.png)](https://landscape.io/github/adybbroe/pygac/feature-clock)
[![Coverage Status](https://coveralls.io/repos/adybbroe/pygac/badge.png?branch=feature-clock)](https://coveralls.io/r/adybbroe/pygac?branch=develop)
[![Code Health](https://landscape.io/github/pytroll/pygac/develop/landscape.png)](https://landscape.io/github/pytroll/pygac/develop)
A python package to read and calibrate NOAA AVHRR GAC data.
A python package to read, calibrate and navigate NOAA AVHRR GAC data.
Abhay Devatshale, Martin Raspaud and Adam Dybbroe
April 2014, Norrkoping, Sweden
#!/usr/bin/env python
# -*- coding: utf-8 -*-
......@@ -26,18 +25,19 @@
"""
import argparse
import logging
from datetime import datetime
logger = logging.getLogger("")
logger = logging.getLogger("pygac")
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
class MyFormatter(logging.Formatter):
converter = datetime.fromtimestamp
def formatTime(self, record, datefmt=None):
ct = self.converter(record.created)
if datefmt:
......@@ -52,9 +52,16 @@ formatter = MyFormatter('[ %(levelname)s %(name)s %(asctime)s] %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)
def check_file_version(filename):
with open(filename) as fdes:
data = fdes.read(3)
try:
with open(filename, mode='rb') as fdes:
try:
data = fdes.read(3).decode()
except UnicodeDecodeError:
data = None
except IOError as err:
raise IOError('Failed to read GAC file: {0}'.format(err))
if data in ["CMS", "NSS", "UKM", "DSS"]:
from pygac.gac_klm import main
return main
......@@ -63,20 +70,39 @@ def check_file_version(filename):
return main
def str2scanline(string):
"""Convert string to scanline.
if __name__ == "__main__":
import sys
try:
filename = sys.argv[1]
start_line = sys.argv[2]
end_line = sys.argv[3]
except IndexError:
print "Usage: gac_run <filename> <start scan line number> <end scan line number>"
sys.exit(1)
reader = check_file_version(filename)
try:
reader(filename, start_line, end_line)
except ValueError:
print "Value error"
Make sure, the scanline is not negative.
Args:
string (str): String to be converted
Returns:
int: Scanline
"""
integer = int(string)
if integer < 0:
raise argparse.ArgumentTypeError('Scanlines must be >= 0')
return integer
def validate_args(args):
if args.end_line > 0 and args.start_line > args.end_line:
raise ValueError('Start Scanline > End Scanline')
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Read, calibrate and navigate NOAA AVHRR GAC data')
parser.add_argument('filename', type=str, help='GAC file to be processed')
parser.add_argument('start_line', type=str2scanline,
help='First scanline to be processed (0-based)')
parser.add_argument('end_line', type=str2scanline,
help='Last scanline to be processed (0-based, '
'set to 0 for the last available scanline)')
args = parser.parse_args()
validate_args(args)
reader = check_file_version(args.filename)
reader(args.filename, args.start_line, args.end_line)
pygac (1.0.1-2) UNRELEASED; urgency=medium
pygac (1.1.0-1) unstable; urgency=medium
* Team upload.
[ Bas Couwenberg ]
* Update gbp.conf to use --source-only-changes by default.
-- Bas Couwenberg <sebastic@debian.org> Sun, 07 Jul 2019 09:39:05 +0200
[ Antonio Valentino ]
* New upstream release.
* Update copyright file.
* debian/patches:
- drop 0001-Compatibility-with-Python-3.patch: applied upstream
- drop 0004-Fix-inconsistent-tabs.patch: no longer necessary
- new 0003-fix-import-mock.patch
- refresh and renumber remaining patches
* debian/control:
- add dependency from scipy
- add build-dependency from cython3 and python-all-dev
* New pygac-bin package.
-- Antonio Valentino <antonio.valentino@tiscali.it> Sun, 07 Jul 2019 17:37:34 +0000
pygac (1.0.1-1) unstable; urgency=medium
......
......@@ -6,7 +6,8 @@ Priority: optional
Testsuite: autopkgtest-pkg-python
Build-Depends: debhelper (>= 11),
dh-python,
python3-all,
cython3,
python3-all-dev,
python3-docutils,
python3-geotiepoints,
python3-h5py,
......@@ -20,11 +21,13 @@ Vcs-Git: https://salsa.debian.org/debian-gis-team/pygac.git
Homepage: https://github.com/pytroll/pygac
Package: python3-pygac
Architecture: all
Architecture: any
Depends: python3-h5py,
python3-numpy,
python3-pyorbital,
python3-scipy,
${python3:Depends},
${shlibs:Depends},
${misc:Depends}
Recommends: python3-geotiepoints,
${python3:Recommends}
......@@ -40,8 +43,33 @@ Description: Python package to read and calibrate NOAA AVHRR GAC data
GAC data from CLASS archive etc) to the L1b file.
In the first pre-processing step, pygac determines whether the GAC
data comes from the second (i.e. NOAA-14 and before) or the third
generation (NOAA-15 and onwards) AVHRR instrument by pygac-run.
generation (NOAA-15 and onwards) AVHRR instrument by "pygac-run".
This is done by reading the first three bytes of the data set.
If they contain the any of the following values, [CMS, NSS, UKM,
DSS], then the KLM reader from gac_klm.py file is invoked,
If they contain the any of the following values, ["CMS", "NSS", "UKM",
"DSS"], then the KLM reader from "gac_klm.py" file is invoked,
otherwise the POD reader is invoked (gac_pod.py).
Package: pygac-bin
Architecture: all
Section: utils
Depends: python3-pygac,
${python3:Depends},
${misc:Depends}
Description: Python package to read and calibrate NOAA AVHRR GAC data - scripts
pygac reads NOAA AVHRR Global Area Coverage (GAC) data, and performs
state of the art calibration and navigation.
.
It must be noted that pygac expects Level 1b file to contain normal
GAC header and data records, the format of which are mentioned in the
official NOAA POD and KLM Data User Guides.
The user should not prepend any other header (e.g. when downloading
GAC data from CLASS archive etc) to the L1b file.
In the first pre-processing step, pygac determines whether the GAC
data comes from the second (i.e. NOAA-14 and before) or the third
generation (NOAA-15 and onwards) AVHRR instrument by "pygac-run".
This is done by reading the first three bytes of the data set.
If they contain the any of the following values, ["CMS", "NSS", "UKM",
"DSS"], then the KLM reader from "gac_klm.py" file is invoked,
otherwise the POD reader is invoked (gac_pod.py).
.
This package provides utilities and executable scripts.
......@@ -4,10 +4,13 @@ Upstream-Contact: Abhay Devasthale <adam.dybbroe@smhi.se>
Source: https://github.com/pytroll/pygac
Files: *
Copyright: 2010-2015 Martin Raspaud <martin.raspaud@smhi.se>
Copyright: 2010-2019 Martin Raspaud <martin.raspaud@smhi.se>
Adam Dybbroe <adam.dybbroe@smhi.se>
Abhay Devasthale <abhay.devasthale@smhi.se>
Sara Hornquist <sara.hornquist@smhi.se>
Stephan Finkensieper <stephan.finkensieper@dwd.de>
Cornelia Schlundt <cornelia.schlundt@dwd.de>
Pytroll Developers
License: GPL-3+
Files: debian/*
......
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Mon, 28 May 2018 22:06:58 +0000
Subject: Compatibility with Python 3
---
pygac/__init__.py | 5 ++---
pygac/calibrate_klm.py | 21 +++++++++++----------
pygac/calibrate_pod.py | 25 +++++++++++++------------
pygac/gac_calibration.py | 15 ++++++++-------
pygac/gac_klm.py | 4 +++-
pygac/gac_pod.py | 4 +++-
pygac/gac_run.py | 5 +++--
pygac/geotiepoints.py | 6 ++++--
8 files changed, 47 insertions(+), 38 deletions(-)
diff --git a/pygac/__init__.py b/pygac/__init__.py
index aa2746c..4be2901 100644
--- a/pygac/__init__.py
+++ b/pygac/__init__.py
@@ -23,12 +23,11 @@
"""
"""
+#from __future__ import absolute_import
import logging
import os
-import version
-
-__version__ = version.__version__
+from pygac.version import __version__
LOG = logging.getLogger(__name__)
try:
diff --git a/pygac/calibrate_klm.py b/pygac/calibrate_klm.py
index 6dfb5bd..2be35ec 100644
--- a/pygac/calibrate_klm.py
+++ b/pygac/calibrate_klm.py
@@ -22,6 +22,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from __future__ import print_function, division
import numpy as np
import sys
MISSING_DATA = -32001
@@ -199,10 +200,10 @@ def calibrate_solar(counts, year, jday, spacecraft_id, channel3_switch, corr, nu
# metop-01 is missing here. But as this code is never called, I do
# not add it for now. /Sara Hornquist 2015-01-07
else:
- print "wrong satellite id - exit"
+ print("wrong satellite id - exit")
sys.exit(0)
- print 'year, jday, spacecraft-id, launch date - ', year, jday, spacecraft_id, Ldate
+ print('year, jday, spacecraft-id, launch date - ', year, jday, spacecraft_id, Ldate)
t = (year + jday / 365.0) - Ldate
@@ -549,7 +550,7 @@ def calibrate_thermal(raw_counts, prt, ict, space, number_of_data_records, space
b2 = 0.00025239
else:
- print "wrong satellite id - exit"
+ print("wrong satellite id - exit")
sys.exit(0)
# adjustment and preparation for calculating four PRT temperatures
@@ -569,7 +570,7 @@ def calibrate_thermal(raw_counts, prt, ict, space, number_of_data_records, space
iprt = (line_numbers - 1 - offset) % 5
- tprt = np.zeros((float(number_of_data_records)))
+ tprt = np.zeros(number_of_data_records, dtype=np.float)
iones = np.where(iprt == 1)
itwos = np.where(iprt == 2)
ithrees = np.where(iprt == 3)
@@ -610,12 +611,12 @@ def calibrate_thermal(raw_counts, prt, ict, space, number_of_data_records, space
tprt_convolved = np.convolve(tprt, weighting_function, 'same')
ict_convolved = np.convolve(ict, weighting_function, 'same')
space_convolved = np.convolve(space, weighting_function, 'same')
- tprt_convolved[0:(window - 1) / 2] = tprt_convolved[(window - 1) / 2]
- ict_convolved[0:(window - 1) / 2] = ict_convolved[(window - 1) / 2]
- space_convolved[0:(window - 1) / 2] = space_convolved[(window - 1) / 2]
- tprt_convolved[-(window - 1) / 2:] = tprt_convolved[-((window + 1) / 2)]
- ict_convolved[-(window - 1) / 2:] = ict_convolved[-((window + 1) / 2)]
- space_convolved[-(window - 1) / 2:] = space_convolved[-((window + 1) / 2)]
+ tprt_convolved[0:(window - 1) // 2] = tprt_convolved[(window - 1) // 2]
+ ict_convolved[0:(window - 1) // 2] = ict_convolved[(window - 1) // 2]
+ space_convolved[0:(window - 1) // 2] = space_convolved[(window - 1) // 2]
+ tprt_convolved[-(window - 1) // 2:] = tprt_convolved[-((window + 1) // 2)]
+ ict_convolved[-(window - 1) // 2:] = ict_convolved[-((window + 1) // 2)]
+ space_convolved[-(window - 1) // 2:] = space_convolved[-((window + 1) // 2)]
new_tprt = np.transpose(np.tile(tprt_convolved, (raw_counts.shape[1], 1)))
new_ict = np.transpose(np.tile(ict_convolved, (raw_counts.shape[1], 1)))
diff --git a/pygac/calibrate_pod.py b/pygac/calibrate_pod.py
index d90af1d..91ec7b8 100644
--- a/pygac/calibrate_pod.py
+++ b/pygac/calibrate_pod.py
@@ -27,6 +27,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from __future__ import print_function, division
import numpy as np
MISSING_DATA = -32001
@@ -232,11 +233,11 @@ def calibrate_solar_pod(counts, year, jday, spacecraft_id, channel3_switch, corr
Ldate = 1994.9699
else:
- print "wrong satellite id - exit"
+ print("wrong satellite id - exit")
sys.exit(0)
- print 'year, jday, spacecraft-id, launch date - ', year, jday, spacecraft_id, Ldate
+ print('year, jday, spacecraft-id, launch date - ', year, jday, spacecraft_id, Ldate)
t = (year + jday / 365.0) - Ldate
# channel 1
@@ -516,7 +517,7 @@ def calibrate_thermal_pod(raw_counts, prt, ict, space, number_of_data_records, s
b2 = 0.0001742
b0 = 2.00
else:
- print "wrong satellite id - exit"
+ print("wrong satellite id - exit")
sys.exit(0)
columns = raw_counts.shape[1]
@@ -570,15 +571,15 @@ def calibrate_thermal_pod(raw_counts, prt, ict, space, number_of_data_records, s
tprt_convolved = np.convolve(tprt, weighting_function, 'same')
ict_convolved = np.convolve(ict, weighting_function, 'same')
space_convolved = np.convolve(space, weighting_function, 'same')
- print tprt
- print tprt_convolved
- tprt_convolved[0:(window - 1) / 2] = tprt_convolved[(window - 1) / 2]
- ict_convolved[0:(window - 1) / 2] = ict_convolved[(window - 1) / 2]
- space_convolved[0:(window - 1) / 2] = space_convolved[(window - 1) / 2]
- tprt_convolved[-(window - 1) / 2:] = tprt_convolved[-((window + 1) / 2)]
- ict_convolved[-(window - 1) / 2:] = ict_convolved[-((window + 1) / 2)]
- space_convolved[-(window - 1) / 2:] = space_convolved[-((window + 1) / 2)]
- print tprt_convolved
+ print(tprt)
+ print(tprt_convolved)
+ tprt_convolved[0:(window - 1) // 2] = tprt_convolved[(window - 1) // 2]
+ ict_convolved[0:(window - 1) // 2] = ict_convolved[(window - 1) // 2]
+ space_convolved[0:(window - 1) // 2] = space_convolved[(window - 1) // 2]
+ tprt_convolved[-(window - 1) // 2:] = tprt_convolved[-((window + 1) // 2)]
+ ict_convolved[-(window - 1) // 2:] = ict_convolved[-((window + 1) // 2)]
+ space_convolved[-(window - 1) // 2:] = space_convolved[-((window + 1) // 2)]
+ print(tprt_convolved)
new_tprt = np.transpose(np.tile(tprt_convolved, (columns, 1)))
new_ict = np.transpose(np.tile(ict_convolved, (columns, 1)))
new_space = np.transpose(np.tile(space_convolved, (columns, 1)))
diff --git a/pygac/gac_calibration.py b/pygac/gac_calibration.py
index 9f2677b..e11b14c 100644
--- a/pygac/gac_calibration.py
+++ b/pygac/gac_calibration.py
@@ -23,6 +23,7 @@
"""Calibration coefficients and generic calibration functions
"""
+from __future__ import division
import numpy as np
coeffs = {
@@ -504,13 +505,13 @@ def calibrate_thermal(counts, prt, ict, space, line_numbers, channel, spacecraft
space_convolved = np.convolve(space, weighting_function, 'same')
# take care of the beginning and end
- tprt_convolved[0:(wlength - 1) / 2] = tprt_convolved[(wlength - 1) / 2]
- ict_convolved[0:(wlength - 1) / 2] = ict_convolved[(wlength - 1) / 2]
- space_convolved[0:(wlength - 1) / 2] = space_convolved[(wlength - 1) / 2]
- tprt_convolved[-(wlength - 1) / 2:] = tprt_convolved[-((wlength + 1) / 2)]
- ict_convolved[-(wlength - 1) / 2:] = ict_convolved[-((wlength + 1) / 2)]
- space_convolved[-(wlength - 1) / 2:] = \
- space_convolved[-((wlength + 1) / 2)]
+ tprt_convolved[0:(wlength - 1) // 2] = tprt_convolved[(wlength - 1) // 2]
+ ict_convolved[0:(wlength - 1) // 2] = ict_convolved[(wlength - 1) // 2]
+ space_convolved[0:(wlength - 1) // 2] = space_convolved[(wlength - 1) // 2]
+ tprt_convolved[-(wlength - 1) // 2:] = tprt_convolved[-((wlength + 1) // 2)]
+ ict_convolved[-(wlength - 1) // 2:] = ict_convolved[-((wlength + 1) // 2)]
+ space_convolved[-(wlength - 1) // 2:] = \
+ space_convolved[-((wlength + 1) // 2)]
new_tprt = np.transpose(np.tile(tprt_convolved, (columns, 1)))
new_ict = np.transpose(np.tile(ict_convolved, (columns, 1)))
diff --git a/pygac/gac_klm.py b/pygac/gac_klm.py
index 71915f7..a6e57aa 100644
--- a/pygac/gac_klm.py
+++ b/pygac/gac_klm.py
@@ -29,6 +29,8 @@ http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/klm/html/c8/sec83142-1.htm
"""
+from __future__ import print_function
+
import numpy as np
from pygac.gac_reader import GACReader
import pygac.geotiepoints as gtp
@@ -611,7 +613,7 @@ def main(filename, start_line, end_line):
mask, qual_flags = reader.get_corrupt_mask()
if (np.all(mask)):
- print "ERROR: All data is masked out. Stop processing"
+ print("ERROR: All data is masked out. Stop processing")
raise ValueError("All data is masked out.")
gac_io.save_gac(reader.spacecraft_name,
diff --git a/pygac/gac_pod.py b/pygac/gac_pod.py
index 55bbb82..1f2cd7d 100644
--- a/pygac/gac_pod.py
+++ b/pygac/gac_pod.py
@@ -35,6 +35,8 @@ http://www.ncdc.noaa.gov/oa/pod-guide/ncdc/docs/podug/html/c3/sec3-1.htm
"""
+from __future__ import print_function
+
import datetime
import logging
@@ -425,7 +427,7 @@ def main(filename, start_line, end_line):
mask, qual_flags = reader.get_corrupt_mask()
if (np.all(mask)):
- print "ERROR: All data is masked out. Stop processing"
+ print("ERROR: All data is masked out. Stop processing")
raise ValueError("All data is masked out.")
gac_io.save_gac(reader.spacecraft_name,
diff --git a/pygac/gac_run.py b/pygac/gac_run.py
index 7472f14..fdac9e5 100644
--- a/pygac/gac_run.py
+++ b/pygac/gac_run.py
@@ -26,6 +26,7 @@
"""
+from __future__ import print_function
import logging
@@ -71,12 +72,12 @@ if __name__ == "__main__":
start_line = sys.argv[2]
end_line = sys.argv[3]
except IndexError:
- print "Usage: gac_run <filename> <start scan line number> <end scan line number>"
+ print("Usage: gac_run <filename> <start scan line number> <end scan line number>")
sys.exit(1)
reader = check_file_version(filename)
try:
reader(filename, start_line, end_line)
except ValueError:
- print "Value error"
+ print("Value error")
diff --git a/pygac/geotiepoints.py b/pygac/geotiepoints.py
index 16057a5..d4730e5 100644
--- a/pygac/geotiepoints.py
+++ b/pygac/geotiepoints.py
@@ -24,6 +24,8 @@
"""Interpolation of geographical tiepoints.
"""
+from __future__ import print_function
+
import numpy as np
from numpy import arccos, sign, rad2deg, sqrt, arcsin
from scipy.interpolate import RectBivariateSpline, splrep, splev
@@ -599,7 +601,7 @@ class TestMODIS(unittest.TestCase):
gdata = SD(gfilename)
data = SD(filename)
except HDF4Error:
- print "Failed reading both eos-hdf files %s and %s" % (gfilename, filename)
+ print("Failed reading both eos-hdf files %s and %s" % (gfilename, filename))
return
glats = gdata.select("Latitude")[:]
@@ -632,7 +634,7 @@ class TestMODIS(unittest.TestCase):
try:
gdata = SD(gfilename)
except HDF4Error:
- print "Failed reading eos-hdf file %s" % gfilename
+ print("Failed reading eos-hdf file %s" % gfilename)
return
lats = gdata.select("Latitude")[0:50, :]
......@@ -9,10 +9,10 @@ See also upstream issue https://github.com/pytroll/pygac/issues/16.
2 files changed, 2 insertions(+)
diff --git a/pygac/tests/test_calibrate_klm.py b/pygac/tests/test_calibrate_klm.py
index ca6d2c8..b3b9663 100644
index 3ea36e8..7ed9015 100644
--- a/pygac/tests/test_calibrate_klm.py
+++ b/pygac/tests/test_calibrate_klm.py
@@ -32,6 +32,7 @@ import numpy as np
@@ -33,6 +33,7 @@ from pygac.calibration import calibrate_solar, calibrate_thermal
class TestGenericCalibration(unittest.TestCase):
......@@ -21,10 +21,10 @@ index ca6d2c8..b3b9663 100644
counts = np.array([[0, 0, 0, 0, 0,
diff --git a/pygac/tests/test_calibrate_pod.py b/pygac/tests/test_calibrate_pod.py
index b52fe3b..5fef429 100644
index 6027e35..fcf4cdb 100644
--- a/pygac/tests/test_calibrate_pod.py
+++ b/pygac/tests/test_calibrate_pod.py
@@ -32,6 +32,7 @@ import numpy as np
@@ -33,6 +33,7 @@ from pygac.calibration import calibrate_solar, calibrate_thermal
class TestGenericCalibration(unittest.TestCase):
......
......@@ -9,10 +9,10 @@ Subject: Fix config
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/pygac/__init__.py b/pygac/__init__.py
index 4be2901..c33fbd7 100644
index f7fee41..4425074 100644
--- a/pygac/__init__.py
+++ b/pygac/__init__.py
@@ -34,7 +34,7 @@ try:
@@ -30,7 +30,7 @@ try:
CONFIG_FILE = os.environ['PYGAC_CONFIG_FILE']
except KeyError:
LOG.error('Environment variable PYGAC_CONFIG_FILE not set!')
......@@ -20,12 +20,12 @@ index 4be2901..c33fbd7 100644
+ CONFIG_FILE = '/etc/pygac.cfg'
if not os.path.exists(CONFIG_FILE) or not os.path.isfile(CONFIG_FILE):
LOG.warning(str(CONFIG_FILE) + " pointed to by the environment " +
LOG.warning(str(CONFIG_FILE) + " pointed to by the environment "
diff --git a/pygac/gac_io.py b/pygac/gac_io.py
index e53047b..3987f79 100644
index a2f0cf4..d613718 100644
--- a/pygac/gac_io.py
+++ b/pygac/gac_io.py
@@ -40,7 +40,7 @@ try:
@@ -48,7 +48,7 @@ try:
CONFIG_FILE = os.environ['PYGAC_CONFIG_FILE']
except KeyError:
LOG.exception('Environment variable PYGAC_CONFIG_FILE not set!')
......@@ -35,17 +35,17 @@ index e53047b..3987f79 100644
if not os.path.exists(CONFIG_FILE) or not os.path.isfile(CONFIG_FILE):
raise IOError(str(CONFIG_FILE) + " pointed to by the environment " +
diff --git a/setup.py b/setup.py
index a2fd529..1f04e08 100644
index 803d379..2d08902 100644
--- a/setup.py
+++ b/setup.py
@@ -60,8 +60,8 @@ setup(name='pygac',
@@ -105,8 +105,8 @@ if __name__ == '__main__':
extras_require={'geolocation interpolation': ['python-geotiepoints'],
},
scripts=[],
scripts=[os.path.join('bin', item) for item in os.listdir('bin')],
- data_files=[('etc', ['etc/pygac.cfg.template']),
- ('gapfilled_tles', ['gapfilled_tles/TLE_noaa16.txt'])],
+ data_files=[ # ('etc', ['etc/pygac.cfg.template']),
+ ('share/pygac/gapfilled_tles', ['gapfilled_tles/TLE_noaa16.txt'])],
test_suite="pygac.tests.suite",
tests_require=[],
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Sun, 7 Jul 2019 21:49:26 +0200
Subject: fix import mock
---
pygac/tests/test_io.py | 2 +-
pygac/tests/test_reader.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pygac/tests/test_io.py b/pygac/tests/test_io.py
index db278bb..69f96a3 100644
--- a/pygac/tests/test_io.py
+++ b/pygac/tests/test_io.py
@@ -19,7 +19,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import unittest
-import mock
+from unittest import mock
import numpy as np
from pygac.gac_io import update_start_end_line
diff --git a/pygac/tests/test_reader.py b/pygac/tests/test_reader.py
index 7574017..868385a 100644
--- a/pygac/tests/test_reader.py
+++ b/pygac/tests/test_reader.py
@@ -20,7 +20,7 @@
import datetime
import unittest
-import mock
+from unittest import mock
import numpy as np
from pygac.gac_reader import GACReader
From: Antonio Valentino <antonio.valentino@tiscali.it>
Date: Mon, 24 Dec 2018 10:25:55 +0100
Subject: Fix inconsistent tabs
---
pygac/gac_klm.py | 32 ++++++++++++++++----------------
pygac/gac_run.py | 8 ++++----
2 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/pygac/gac_klm.py b/pygac/gac_klm.py
index a6e57aa..952e12b 100644
--- a/pygac/gac_klm.py
+++ b/pygac/gac_klm.py
@@ -530,19 +530,19 @@ class KLMReader(GACReader):
jday = self.scans["scan_line_day_of_year"]
msec = self.scans["scan_line_utc_time_of_day"]
- jday = np.where(np.logical_or(jday<1, jday>366),np.median(jday),jday)
- if_wrong_jday = np.ediff1d(jday, to_begin=0)
- jday = np.where(if_wrong_jday<0, max(jday), jday)
-
- if_wrong_msec = np.where(msec<1)
- if_wrong_msec = if_wrong_msec[0]
- if len(if_wrong_msec) > 0:
- if if_wrong_msec[0] !=0:
- msec = msec[0] + 0.5 * 1000.0 * (self.scans["scan_line_number"] - 1)
- else:
- msec = np.median(msec - 0.5 * 1000.0 * (self.scans["scan_line_number"] - 1))
-
- if_wrong_msec = np.ediff1d(msec, to_begin=0)
+ jday = np.where(np.logical_or(jday<1, jday>366),np.median(jday),jday)
+ if_wrong_jday = np.ediff1d(jday, to_begin=0)
+ jday = np.where(if_wrong_jday<0, max(jday), jday)
+
+ if_wrong_msec = np.where(msec<1)
+ if_wrong_msec = if_wrong_msec[0]
+ if len(if_wrong_msec) > 0:
+ if if_wrong_msec[0] !=0:
+ msec = msec[0] + 0.5 * 1000.0 * (self.scans["scan_line_number"] - 1)
+ else:
+ msec = np.median(msec - 0.5 * 1000.0 * (self.scans["scan_line_number"] - 1))
+
+ if_wrong_msec = np.ediff1d(msec, to_begin=0)
msec = np.where(np.logical_and(np.logical_or(if_wrong_msec<-1000, if_wrong_msec>1000),if_wrong_jday!=1), msec[0] + 0.5 * 1000.0 * (self.scans["scan_line_number"] - 1), msec)
@@ -552,7 +552,7 @@ class KLMReader(GACReader):
self.times = self.utcs.astype(datetime.datetime)
- # checking if year value is out of valid range
+ # checking if year value is out of valid range
if_wrong_year = np.where(np.logical_or(year<1978, year>2015))
if_wrong_year = if_wrong_year[0]
if len(if_wrong_year) > 0:
@@ -590,7 +590,7 @@ class KLMReader(GACReader):
((self.scans["quality_indicator_bit_field"] << 3) >> 31) |
((self.scans["quality_indicator_bit_field"] << 4) >> 31))
- number_of_scans = self.scans["telemetry"].shape[0]
+ number_of_scans = self.scans["telemetry"].shape[0]
qual_flags = np.zeros((int(number_of_scans),7))
qual_flags[:,0]=self.scans["scan_line_number"]
qual_flags[:,1]=(self.scans["quality_indicator_bit_field"] >> 31)
@@ -600,7 +600,7 @@ class KLMReader(GACReader):
qual_flags[:,5]=((self.scans["quality_indicator_bit_field"] << 26) >> 30)
qual_flags[:,6]=((self.scans["quality_indicator_bit_field"] << 28) >> 30)
- return mask.astype(bool), qual_flags
+ return mask.astype(bool), qual_flags
def main(filename, start_line, end_line):
diff --git a/pygac/gac_run.py b/pygac/gac_run.py
index fdac9e5..d88b656 100644
--- a/pygac/gac_run.py
+++ b/pygac/gac_run.py
@@ -69,11 +69,11 @@ if __name__ == "__main__":
import sys
try:
filename = sys.argv[1]
- start_line = sys.argv[2]
- end_line = sys.argv[3]
+ start_line = sys.argv[2]
+ end_line = sys.argv[3]
except IndexError:
- print("Usage: gac_run <filename> <start scan line number> <end scan line number>")
- sys.exit(1)
+ print("Usage: gac_run <filename> <start scan line number> <end scan line number>")
+ sys.exit(1)
reader = check_file_version(filename)
try:
0001-Compatibility-with-Python-3.patch
0002-Temporary-disable-broken-tests.patch
0003-Fix-config.patch
0004-Fix-inconsistent-tabs.patch
0001-Temporary-disable-broken-tests.patch
0002-Fix-config.patch
0003-fix-import-mock.patch
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.10.
.TH PYGAC-RUN "1" "July 2019" "pygac-run 1.1.0" "User Commands"
.SH NAME
pygac-run \- read, calibrate and navigate NOAA AVHRR GAC data
.SH DESCRIPTION
usage: pygac\-run [\-h] filename start_line end_line
.PP
Read, calibrate and navigate NOAA AVHRR GAC data
.SS "positional arguments:"
.TP
filename
GAC file to be processed
.TP
start_line
First scanline to be processed (0\-based)
.TP
end_line
Last scanline to be processed (0\-based, set to 0 for the last
available scanline)
.SS "optional arguments:"
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.SH "SEE ALSO"
The full documentation for
.B pygac-run
is maintained as a Texinfo manual. If the
.B info
and
.B pygac-run
programs are properly installed at your site, the command
.IP
.B info pygac-run
.PP
should give you access to the complete manual.
[tle]
tledir = gapfilled_tles
tlename = TLE_%(satname)s.txt
[output]
output_dir = /tmp
output_file_prefix = ECC_GAC