File: modisinterpolator.py

package info (click to toggle)
python-geotiepoints 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,876 kB
  • sloc: python: 3,148; makefile: 111; sh: 15
file content (76 lines) | stat: -rw-r--r-- 3,059 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright (c) 2018-2023 Python-geotiepoints developers
#
# 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/>.
"""Interpolation of MODIS data using satellite zenith angle.

Interpolation of geographical tiepoints using the second order interpolation
scheme implemented in the CVIIRS software, as described here:
Compact VIIRS SDR Product Format User Guide (V1J)
https://www.eumetsat.int/media/45988
and
Anders Meier Soerensen, Stephan Zinke,
A tie-point zone group compaction schema for the geolocation data of S-NPP and NOAA-20 VIIRS SDRs to reduce file sizes
in memory-sensitive environments,
Applied Computing and Geosciences, Volume 6, 2020, 100025, ISSN 2590-1974,
https://doi.org/10.1016/j.acags.2020.100025.
(https://www.sciencedirect.com/science/article/pii/S2590197420300070)
"""

import warnings

from ._modis_interpolator import interpolate


def modis_1km_to_250m(lon1, lat1, satz1):
    """Interpolate MODIS geolocation from 1km to 250m resolution."""
    return interpolate(lon1, lat1, satz1,
                       coarse_resolution=1000,
                       fine_resolution=250)


def modis_1km_to_500m(lon1, lat1, satz1):
    """Interpolate MODIS geolocation from 1km to 500m resolution."""
    return interpolate(lon1, lat1, satz1,
                       coarse_resolution=1000,
                       fine_resolution=500)


def modis_5km_to_1km(lon1, lat1, satz1):
    """Interpolate MODIS geolocation from 5km to 1km resolution."""
    return interpolate(lon1, lat1, satz1,
                       coarse_resolution=5000,
                       fine_resolution=1000,
                       coarse_scan_width=lon1.shape[1])


def modis_5km_to_500m(lon1, lat1, satz1):
    """Interpolate MODIS geolocation from 5km to 500m resolution."""
    warnings.warn(
        "Interpolating 5km geolocation to 500m resolution " "may result in poor quality"
    )
    return interpolate(lon1, lat1, satz1,
                       coarse_resolution=5000,
                       fine_resolution=500,
                       coarse_scan_width=lon1.shape[1])


def modis_5km_to_250m(lon1, lat1, satz1):
    """Interpolate MODIS geolocation from 5km to 250m resolution."""
    warnings.warn(
        "Interpolating 5km geolocation to 250m resolution " "may result in poor quality"
    )
    return interpolate(lon1, lat1, satz1,
                       coarse_resolution=5000,
                       fine_resolution=250,
                       coarse_scan_width=lon1.shape[1])