pyarea 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyarea-0.2.0/LICENSE +165 -0
- pyarea-0.2.0/PKG-INFO +156 -0
- pyarea-0.2.0/README.md +133 -0
- pyarea-0.2.0/pyarea/__init__.py +4 -0
- pyarea-0.2.0/pyarea/calibration.py +644 -0
- pyarea-0.2.0/pyarea/directory.py +403 -0
- pyarea-0.2.0/pyarea/file.py +752 -0
- pyarea-0.2.0/pyarea/nav.py +2837 -0
- pyarea-0.2.0/pyarea/navigation/__init__.py +3 -0
- pyarea-0.2.0/pyarea/navigation/area_navigation.py +183 -0
- pyarea-0.2.0/pyarea/navigation/hrit_navigation.py +475 -0
- pyarea-0.2.0/pyarea/navigation/proj4_navigation.py +107 -0
- pyarea-0.2.0/pyarea/sensors.py +249 -0
- pyarea-0.2.0/pyarea/utils.py +316 -0
- pyarea-0.2.0/pyarea.egg-info/PKG-INFO +156 -0
- pyarea-0.2.0/pyarea.egg-info/SOURCES.txt +34 -0
- pyarea-0.2.0/pyarea.egg-info/dependency_links.txt +1 -0
- pyarea-0.2.0/pyarea.egg-info/requires.txt +7 -0
- pyarea-0.2.0/pyarea.egg-info/top_level.txt +1 -0
- pyarea-0.2.0/pyproject.toml +46 -0
- pyarea-0.2.0/setup.cfg +4 -0
- pyarea-0.2.0/tests/test_abin_nav.py +157 -0
- pyarea-0.2.0/tests/test_area_nav_factory.py +62 -0
- pyarea-0.2.0/tests/test_directory.py +270 -0
- pyarea-0.2.0/tests/test_geos_nav.py +158 -0
- pyarea-0.2.0/tests/test_gmsx_nav.py +116 -0
- pyarea-0.2.0/tests/test_goes_nav.py +177 -0
- pyarea-0.2.0/tests/test_gvar_calibration.py +207 -0
- pyarea-0.2.0/tests/test_gvar_nav.py +241 -0
- pyarea-0.2.0/tests/test_lalo_nav.py +311 -0
- pyarea-0.2.0/tests/test_msat_nav.py +161 -0
- pyarea-0.2.0/tests/test_msgt_nav.py +152 -0
- pyarea-0.2.0/tests/test_pregvar_file.py +409 -0
- pyarea-0.2.0/tests/test_rect_nav.py +131 -0
- pyarea-0.2.0/tests/test_sensors.py +90 -0
- pyarea-0.2.0/tests/test_utils.py +142 -0
pyarea-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
|
2
|
+
Version 3, 29 June 2007
|
|
3
|
+
|
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
6
|
+
of this license document, but changing it is not allowed.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
|
11
|
+
License, supplemented by the additional permissions listed below.
|
|
12
|
+
|
|
13
|
+
0. Additional Definitions.
|
|
14
|
+
|
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
|
17
|
+
General Public License.
|
|
18
|
+
|
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
|
20
|
+
other than an Application or a Combined Work as defined below.
|
|
21
|
+
|
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
|
25
|
+
of using an interface provided by the Library.
|
|
26
|
+
|
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
|
28
|
+
Application with the Library. The particular version of the Library
|
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
|
30
|
+
Version".
|
|
31
|
+
|
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
|
35
|
+
based on the Application, and not on the Linked Version.
|
|
36
|
+
|
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
|
38
|
+
object code and/or source code for the Application, including any data
|
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
|
41
|
+
|
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
|
43
|
+
|
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
|
46
|
+
|
|
47
|
+
2. Conveying Modified Versions.
|
|
48
|
+
|
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
|
51
|
+
that uses the facility (other than as an argument passed when the
|
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
|
53
|
+
version:
|
|
54
|
+
|
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
|
56
|
+
ensure that, in the event an Application does not supply the
|
|
57
|
+
function or data, the facility still operates, and performs
|
|
58
|
+
whatever part of its purpose remains meaningful, or
|
|
59
|
+
|
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
|
61
|
+
this License applicable to that copy.
|
|
62
|
+
|
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
|
64
|
+
|
|
65
|
+
The object code form of an Application may incorporate material from
|
|
66
|
+
a header file that is part of the Library. You may convey such object
|
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
|
68
|
+
material is not limited to numerical parameters, data structure
|
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
|
71
|
+
|
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
|
73
|
+
Library is used in it and that the Library and its use are
|
|
74
|
+
covered by this License.
|
|
75
|
+
|
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
|
77
|
+
document.
|
|
78
|
+
|
|
79
|
+
4. Combined Works.
|
|
80
|
+
|
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
|
82
|
+
taken together, effectively do not restrict modification of the
|
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
|
85
|
+
the following:
|
|
86
|
+
|
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
|
88
|
+
the Library is used in it and that the Library and its use are
|
|
89
|
+
covered by this License.
|
|
90
|
+
|
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
|
92
|
+
document.
|
|
93
|
+
|
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
|
95
|
+
execution, include the copyright notice for the Library among
|
|
96
|
+
these notices, as well as a reference directing the user to the
|
|
97
|
+
copies of the GNU GPL and this license document.
|
|
98
|
+
|
|
99
|
+
d) Do one of the following:
|
|
100
|
+
|
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
|
102
|
+
License, and the Corresponding Application Code in a form
|
|
103
|
+
suitable for, and under terms that permit, the user to
|
|
104
|
+
recombine or relink the Application with a modified version of
|
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
|
107
|
+
Corresponding Source.
|
|
108
|
+
|
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
|
111
|
+
a copy of the Library already present on the user's computer
|
|
112
|
+
system, and (b) will operate properly with a modified version
|
|
113
|
+
of the Library that is interface-compatible with the Linked
|
|
114
|
+
Version.
|
|
115
|
+
|
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
|
117
|
+
be required to provide such information under section 6 of the
|
|
118
|
+
GNU GPL, and only to the extent that such information is
|
|
119
|
+
necessary to install and execute a modified version of the
|
|
120
|
+
Combined Work produced by recombining or relinking the
|
|
121
|
+
Application with a modified version of the Linked Version. (If
|
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
|
126
|
+
for conveying Corresponding Source.)
|
|
127
|
+
|
|
128
|
+
5. Combined Libraries.
|
|
129
|
+
|
|
130
|
+
You may place library facilities that are a work based on the
|
|
131
|
+
Library side by side in a single library together with other library
|
|
132
|
+
facilities that are not Applications and are not covered by this
|
|
133
|
+
License, and convey such a combined library under terms of your
|
|
134
|
+
choice, if you do both of the following:
|
|
135
|
+
|
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
|
137
|
+
on the Library, uncombined with any other library facilities,
|
|
138
|
+
conveyed under the terms of this License.
|
|
139
|
+
|
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
|
141
|
+
is a work based on the Library, and explaining where to find the
|
|
142
|
+
accompanying uncombined form of the same work.
|
|
143
|
+
|
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
|
145
|
+
|
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
|
148
|
+
versions will be similar in spirit to the present version, but may
|
|
149
|
+
differ in detail to address new problems or concerns.
|
|
150
|
+
|
|
151
|
+
Each version is given a distinguishing version number. If the
|
|
152
|
+
Library as you received it specifies that a certain numbered version
|
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
|
154
|
+
applies to it, you have the option of following the terms and
|
|
155
|
+
conditions either of that published version or of any later version
|
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
|
160
|
+
|
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
|
164
|
+
permanent authorization for you to choose that version for the
|
|
165
|
+
Library.
|
pyarea-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyarea
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Python package for reading McIDAS AREA files
|
|
5
|
+
Author: Kin Largadas
|
|
6
|
+
Author-email: Ioan Ferencik <ferencikioan@gmail.com>
|
|
7
|
+
License-Expression: LGPL-3.0-or-later
|
|
8
|
+
Project-URL: Homepage, https://github.com/geosatformats/pyarea
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: numpy>=1.24
|
|
17
|
+
Requires-Dist: numba
|
|
18
|
+
Requires-Dist: pyproj
|
|
19
|
+
Provides-Extra: test
|
|
20
|
+
Requires-Dist: pytest; extra == "test"
|
|
21
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# Pyarea
|
|
25
|
+
|
|
26
|
+
Pyarea is a Python package that reads data in the SSEC McIDAS AREA format.
|
|
27
|
+
|
|
28
|
+
The navigation is a port of the `edu.wisc.ssec.mcidas` Java package:
|
|
29
|
+
it mostly mimics its structure and logic, with a few exceptions
|
|
30
|
+
imposed by practical aspects of the Python language. Some additional,
|
|
31
|
+
more efficient methods were added that work on numpy arrays
|
|
32
|
+
(`to_latlon`, `to_lin_ele`).
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
pip install .
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Python 3.10 or later; numpy, numba and pyproj are needed.
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
An `AreaFile` can be made from a file name or from the bytes of a file.
|
|
45
|
+
It is lightweight and initializes lazily: the data are only read on request,
|
|
46
|
+
and come back as a 3D numpy array (use `squeeze` for a 2D one).
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from pyarea import AreaFile
|
|
50
|
+
|
|
51
|
+
area = AreaFile("path/to/file.AREA")
|
|
52
|
+
print(area) # the directory
|
|
53
|
+
data = area.read_data() # the pixels of a single band file, shape (lines, elements)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The pixels are 1, 2 or 4 bytes wide. `area.data` holds all the bands, shape
|
|
57
|
+
`(bands, lines, elements)`.
|
|
58
|
+
|
|
59
|
+
### Navigation
|
|
60
|
+
|
|
61
|
+
`area.navigation` gives the navigation object of the file's nav block
|
|
62
|
+
(`None` if the file has none). Lines and elements are those of the AREA
|
|
63
|
+
file, counted from 0, and the navigation applies the file's start and resolution
|
|
64
|
+
itself:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
nav = area.navigation
|
|
68
|
+
lat, lon = nav.to_latlon(line, elem) # numpy arrays of any shape; NaN where the Earth is not seen
|
|
69
|
+
line, elem = nav.to_lin_ele(lat, lon) # east longitudes are positive
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The Java style methods (`toLatLon`, `toLinEle`, taking lists) are there as well.
|
|
73
|
+
`area.get_lonlats()` earth-locates the whole image with the file's own navigation,
|
|
74
|
+
whatever its type (or only the given `lines=` and `elems=`), and returns `(lon, lat)`:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
import numpy as np
|
|
78
|
+
|
|
79
|
+
lon, lat = area.get_lonlats() # arrays of shape (lines, elements), NaN off the Earth
|
|
80
|
+
lon, lat = area.get_lonlats(lines=np.arange(0, area.lines, 4), elems=np.arange(0, area.elements, 4))
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Currently implemented navigations:
|
|
84
|
+
|
|
85
|
+
| Nav type | Class | Satellites |
|
|
86
|
+
|----------|--------------|---------------------------------------------------------------------|
|
|
87
|
+
| `GVAR` | `GVARNav` | GOES-8 and later (GVAR) |
|
|
88
|
+
| `GOES` | `GOESNav` | SMS and GOES-1 to 7 (pre-GVAR) |
|
|
89
|
+
| `GMSX` | `GMSXNav` | GMS-5 and FY satellites |
|
|
90
|
+
| `RECT` | `RECTNav` | rectilinear (lat/lon) grids |
|
|
91
|
+
| `ABIN` | `ABINNav` | GOES-R ABI fixed grid (GOES-16 and later) |
|
|
92
|
+
| `GEOS` | `GEOSNav` | Himawari, COMS-1 (LRIT/HRIT layout) |
|
|
93
|
+
| `LALO` | `LALONav` | Kalpana-1 and others: tables of latitude and longitude in the aux block |
|
|
94
|
+
| `MSAT` | `MSATNav` | Meteosat first generation (Meteosat-1 to 7) |
|
|
95
|
+
| `MSGT` | `MSGTNav` | Meteosat second generation (Meteosat-8 to 11) |
|
|
96
|
+
|
|
97
|
+
Any other nav type raises `NotImplementedError` and names the ones that are supported.
|
|
98
|
+
All of these have `to_latlon` and `to_lin_ele` for numpy arrays, which `get_lonlats` uses.
|
|
99
|
+
|
|
100
|
+
### Calibration
|
|
101
|
+
|
|
102
|
+
SSEC's McFETCH can give a calibrated area file (with the option "UNIT") like ADDE.
|
|
103
|
+
The directory's calibration type (`area.cal_type`) tells what the file has
|
|
104
|
+
(`TEMP`, `ALB`, `RAD`, `BRIT` or `RAW`).
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
area = AreaFile("mcfetch_band04.area")
|
|
108
|
+
print(area.cal_type, area.directory.calibration_scale_factor) # TEMP 100
|
|
109
|
+
kelvin = area.read_calibrated("TEMP") # a file already in TEMP: its pixels divided by the scaling, float32
|
|
110
|
+
lon, lat = area.get_lonlats()
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
For a file that already holds the requested unit, `read_calibrated` returns its pixels
|
|
114
|
+
divided by the scaling, and asking for another type raises a `ValueError`.
|
|
115
|
+
`area.directory.check(file_size)` lists problems it finds in a directory (an unknown sensor,
|
|
116
|
+
an unsupported pixel width, block offsets outside the file).
|
|
117
|
+
|
|
118
|
+
Area files that were ordered from NOAA CLASS only come in `RAW`, and needs to be calibrated:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
temperature = area.read_calibrated("TEMP") # GVAR imagery: 'RAW', 'RAD', 'ALB', 'TEMP' or 'BRIT'
|
|
122
|
+
reflectance = area.read_vis("unnormalized_reflectance") # a pre-GVAR visible image
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Calibrations currently implemented:
|
|
126
|
+
|
|
127
|
+
* `GVARCalibrator` (GOES-8 and later, GVAR), a vectorized port of VisAD's
|
|
128
|
+
`CalibratorGvar`.
|
|
129
|
+
* `GOESCalibrator` (SMS and GOES-1 to 7), new code that covers Mode A (VISR),
|
|
130
|
+
Mode AA (VAS, GOES-4 to 6) and Mode AAA (VAS, GOES-6 and 7). The visible channel
|
|
131
|
+
only has a relative reflectance; there is no calibration to albedo for these
|
|
132
|
+
satellites.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
Copyright 2017 Ioan Ferencik, Solargis s.r.0 & Kin Largadas
|
|
137
|
+
|
|
138
|
+
This library is a Python port of `edu.wisc.ssec.mcidas`. Copyright 1998 - 2023
|
|
139
|
+
by Tom Whittaker, Tommy Jasmin, Tom Rink, Don Murray, James Kelly, Bill Hibbard,
|
|
140
|
+
Dave Glowacki, Curtis Rueden and others.
|
|
141
|
+
|
|
142
|
+
The original work is licensed under the GNU Library General Public License,
|
|
143
|
+
version 2.0 or later. As permitted in the "or later" clause of the license,
|
|
144
|
+
this port and all its derived modifications are distributed under the terms of
|
|
145
|
+
the GNU Lesser General Public License, version 3.0 or later.
|
|
146
|
+
|
|
147
|
+
This library is free software; you can redistribute it and/or modify it under
|
|
148
|
+
the terms of the GNU Lesser General Public License as published by the Free
|
|
149
|
+
Software Foundation; either version 3.0 of the License, or (at your option)
|
|
150
|
+
any later version. You may obtain a copy of the License at:
|
|
151
|
+
|
|
152
|
+
https://www.gnu.org/licenses/lgpl-3.0.html
|
|
153
|
+
|
|
154
|
+
This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
155
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
156
|
+
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
pyarea-0.2.0/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Pyarea
|
|
2
|
+
|
|
3
|
+
Pyarea is a Python package that reads data in the SSEC McIDAS AREA format.
|
|
4
|
+
|
|
5
|
+
The navigation is a port of the `edu.wisc.ssec.mcidas` Java package:
|
|
6
|
+
it mostly mimics its structure and logic, with a few exceptions
|
|
7
|
+
imposed by practical aspects of the Python language. Some additional,
|
|
8
|
+
more efficient methods were added that work on numpy arrays
|
|
9
|
+
(`to_latlon`, `to_lin_ele`).
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
pip install .
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Python 3.10 or later; numpy, numba and pyproj are needed.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
An `AreaFile` can be made from a file name or from the bytes of a file.
|
|
22
|
+
It is lightweight and initializes lazily: the data are only read on request,
|
|
23
|
+
and come back as a 3D numpy array (use `squeeze` for a 2D one).
|
|
24
|
+
|
|
25
|
+
```python
|
|
26
|
+
from pyarea import AreaFile
|
|
27
|
+
|
|
28
|
+
area = AreaFile("path/to/file.AREA")
|
|
29
|
+
print(area) # the directory
|
|
30
|
+
data = area.read_data() # the pixels of a single band file, shape (lines, elements)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The pixels are 1, 2 or 4 bytes wide. `area.data` holds all the bands, shape
|
|
34
|
+
`(bands, lines, elements)`.
|
|
35
|
+
|
|
36
|
+
### Navigation
|
|
37
|
+
|
|
38
|
+
`area.navigation` gives the navigation object of the file's nav block
|
|
39
|
+
(`None` if the file has none). Lines and elements are those of the AREA
|
|
40
|
+
file, counted from 0, and the navigation applies the file's start and resolution
|
|
41
|
+
itself:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
nav = area.navigation
|
|
45
|
+
lat, lon = nav.to_latlon(line, elem) # numpy arrays of any shape; NaN where the Earth is not seen
|
|
46
|
+
line, elem = nav.to_lin_ele(lat, lon) # east longitudes are positive
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The Java style methods (`toLatLon`, `toLinEle`, taking lists) are there as well.
|
|
50
|
+
`area.get_lonlats()` earth-locates the whole image with the file's own navigation,
|
|
51
|
+
whatever its type (or only the given `lines=` and `elems=`), and returns `(lon, lat)`:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
import numpy as np
|
|
55
|
+
|
|
56
|
+
lon, lat = area.get_lonlats() # arrays of shape (lines, elements), NaN off the Earth
|
|
57
|
+
lon, lat = area.get_lonlats(lines=np.arange(0, area.lines, 4), elems=np.arange(0, area.elements, 4))
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Currently implemented navigations:
|
|
61
|
+
|
|
62
|
+
| Nav type | Class | Satellites |
|
|
63
|
+
|----------|--------------|---------------------------------------------------------------------|
|
|
64
|
+
| `GVAR` | `GVARNav` | GOES-8 and later (GVAR) |
|
|
65
|
+
| `GOES` | `GOESNav` | SMS and GOES-1 to 7 (pre-GVAR) |
|
|
66
|
+
| `GMSX` | `GMSXNav` | GMS-5 and FY satellites |
|
|
67
|
+
| `RECT` | `RECTNav` | rectilinear (lat/lon) grids |
|
|
68
|
+
| `ABIN` | `ABINNav` | GOES-R ABI fixed grid (GOES-16 and later) |
|
|
69
|
+
| `GEOS` | `GEOSNav` | Himawari, COMS-1 (LRIT/HRIT layout) |
|
|
70
|
+
| `LALO` | `LALONav` | Kalpana-1 and others: tables of latitude and longitude in the aux block |
|
|
71
|
+
| `MSAT` | `MSATNav` | Meteosat first generation (Meteosat-1 to 7) |
|
|
72
|
+
| `MSGT` | `MSGTNav` | Meteosat second generation (Meteosat-8 to 11) |
|
|
73
|
+
|
|
74
|
+
Any other nav type raises `NotImplementedError` and names the ones that are supported.
|
|
75
|
+
All of these have `to_latlon` and `to_lin_ele` for numpy arrays, which `get_lonlats` uses.
|
|
76
|
+
|
|
77
|
+
### Calibration
|
|
78
|
+
|
|
79
|
+
SSEC's McFETCH can give a calibrated area file (with the option "UNIT") like ADDE.
|
|
80
|
+
The directory's calibration type (`area.cal_type`) tells what the file has
|
|
81
|
+
(`TEMP`, `ALB`, `RAD`, `BRIT` or `RAW`).
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
area = AreaFile("mcfetch_band04.area")
|
|
85
|
+
print(area.cal_type, area.directory.calibration_scale_factor) # TEMP 100
|
|
86
|
+
kelvin = area.read_calibrated("TEMP") # a file already in TEMP: its pixels divided by the scaling, float32
|
|
87
|
+
lon, lat = area.get_lonlats()
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
For a file that already holds the requested unit, `read_calibrated` returns its pixels
|
|
91
|
+
divided by the scaling, and asking for another type raises a `ValueError`.
|
|
92
|
+
`area.directory.check(file_size)` lists problems it finds in a directory (an unknown sensor,
|
|
93
|
+
an unsupported pixel width, block offsets outside the file).
|
|
94
|
+
|
|
95
|
+
Area files that were ordered from NOAA CLASS only come in `RAW`, and needs to be calibrated:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
temperature = area.read_calibrated("TEMP") # GVAR imagery: 'RAW', 'RAD', 'ALB', 'TEMP' or 'BRIT'
|
|
99
|
+
reflectance = area.read_vis("unnormalized_reflectance") # a pre-GVAR visible image
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Calibrations currently implemented:
|
|
103
|
+
|
|
104
|
+
* `GVARCalibrator` (GOES-8 and later, GVAR), a vectorized port of VisAD's
|
|
105
|
+
`CalibratorGvar`.
|
|
106
|
+
* `GOESCalibrator` (SMS and GOES-1 to 7), new code that covers Mode A (VISR),
|
|
107
|
+
Mode AA (VAS, GOES-4 to 6) and Mode AAA (VAS, GOES-6 and 7). The visible channel
|
|
108
|
+
only has a relative reflectance; there is no calibration to albedo for these
|
|
109
|
+
satellites.
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
Copyright 2017 Ioan Ferencik, Solargis s.r.0 & Kin Largadas
|
|
114
|
+
|
|
115
|
+
This library is a Python port of `edu.wisc.ssec.mcidas`. Copyright 1998 - 2023
|
|
116
|
+
by Tom Whittaker, Tommy Jasmin, Tom Rink, Don Murray, James Kelly, Bill Hibbard,
|
|
117
|
+
Dave Glowacki, Curtis Rueden and others.
|
|
118
|
+
|
|
119
|
+
The original work is licensed under the GNU Library General Public License,
|
|
120
|
+
version 2.0 or later. As permitted in the "or later" clause of the license,
|
|
121
|
+
this port and all its derived modifications are distributed under the terms of
|
|
122
|
+
the GNU Lesser General Public License, version 3.0 or later.
|
|
123
|
+
|
|
124
|
+
This library is free software; you can redistribute it and/or modify it under
|
|
125
|
+
the terms of the GNU Lesser General Public License as published by the Free
|
|
126
|
+
Software Foundation; either version 3.0 of the License, or (at your option)
|
|
127
|
+
any later version. You may obtain a copy of the License at:
|
|
128
|
+
|
|
129
|
+
https://www.gnu.org/licenses/lgpl-3.0.html
|
|
130
|
+
|
|
131
|
+
This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
132
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
133
|
+
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|