[Git][debian-gis-team/python-geotiepoints][upstream] New upstream version 1.1.8
Antonio Valentino
gitlab at salsa.debian.org
Mon Jul 8 07:43:27 BST 2019
Antonio Valentino pushed to branch upstream at Debian GIS Project / python-geotiepoints
Commits:
8d2734d1 by Antonio Valentino at 2019-07-08T06:34:45Z
New upstream version 1.1.8
- - - - -
14 changed files:
- .travis.yml
- CHANGELOG.md
- − PKG-INFO
- geotiepoints/modisinterpolator.py
- geotiepoints/tests/test_modisinterpolator.py
- geotiepoints/version.py
- − python_geotiepoints.egg-info/PKG-INFO
- − python_geotiepoints.egg-info/SOURCES.txt
- − python_geotiepoints.egg-info/dependency_links.txt
- − python_geotiepoints.egg-info/not-zip-safe
- − python_geotiepoints.egg-info/requires.txt
- − python_geotiepoints.egg-info/top_level.txt
- setup.cfg
- setup.py
Changes:
=====================================
.travis.yml
=====================================
@@ -2,9 +2,8 @@ language: python
env:
global:
- PYTHON_VERSION=$PYTHON_VERSION
- - NUMPY_VERSION=stable
- MAIN_CMD='python setup.py'
- - CONDA_DEPENDENCIES='cython pandas scipy numpy coveralls coverage h5py mock dask xarray'
+ - CONDA_DEPENDENCIES='cython pandas scipy coveralls coverage h5py mock dask xarray'
- PIP_DEPENDENCIES=''
- SETUP_XVFB=False
- EVENT_TYPE='push pull_request'
=====================================
CHANGELOG.md
=====================================
@@ -1,3 +1,20 @@
+## Version v1.1.8 (2019/04/24)
+
+### Issues Closed
+
+### Pull Requests Merged
+
+#### Bugs fixed
+
+* [PR 14](https://github.com/pytroll/python-geotiepoints/pull/14) - Fix modis interpolation in tricky places
+
+#### Features added
+
+* [PR 15](https://github.com/pytroll/python-geotiepoints/pull/15) - Add support for modis l2 geolocation interpolation
+
+In this release 2 pull requests were closed.
+
+
## Version v1.1.7 (2018/10/09)
### Issues Closed
=====================================
PKG-INFO deleted
=====================================
@@ -1,17 +0,0 @@
-Metadata-Version: 1.2
-Name: python-geotiepoints
-Version: 1.1.7
-Summary: Interpolation of geographic tiepoints in Python
-Home-page: https://github.com/pytroll/python-geotiepoints
-Author: Adam Dybbroe, Martin Raspaud
-Author-email: martin.raspaud at smhi.se
-License: UNKNOWN
-Description: UNKNOWN
-Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
-Classifier: Intended Audience :: Science/Research
-Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Topic :: Scientific/Engineering
-Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
=====================================
geotiepoints/modisinterpolator.py
=====================================
@@ -22,7 +22,7 @@
"""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)
+Compact VIIRS SDR Product Format User Guide (V1J)
http://www.eumetsat.int/website/wcm/idc/idcplg?IdcService=GET_FILE&dDocName=PDF_DMT_708025&RevisionSelectionMethod=LatestReleased&Rendition=Web
"""
@@ -30,9 +30,6 @@ import xarray as xr
import dask.array as da
import numpy as np
-# TODO on interpolation:
-# - go over to cartesian coordinates for tricky situation (eg poles, dateline)
-
R = 6371.
# Aqua scan width and altitude in km
scan_width = 10.00017
@@ -86,7 +83,7 @@ def get_corners(arr):
class ModisInterpolator():
- def __init__(self, cres, fres):
+ def __init__(self, cres, fres, cscan_full_width=None):
if cres == 1000:
self.cscan_len = 10
self.cscan_width = 1
@@ -94,7 +91,10 @@ class ModisInterpolator():
elif cres == 5000:
self.cscan_len = 2
self.cscan_width = 5
- self.cscan_full_width = 271
+ if cscan_full_width is None:
+ self.cscan_full_width = 271
+ else:
+ self.cscan_full_width = cscan_full_width
if fres == 250:
self.fscan_width = 4 * self.cscan_width
@@ -135,7 +135,10 @@ class ModisInterpolator():
def _expand_tiepoint_array_5km(self, arr, lines, cols):
arr = da.repeat(arr, lines * 2, axis=1)
arr = da.repeat(arr.reshape((-1, self.cscan_full_width - 1)), cols, axis=1)
- return da.hstack((arr[:, :2], arr, arr[:, -2:]))
+ if self.cscan_full_width == 271:
+ return da.hstack((arr[:, :2], arr, arr[:, -2:]))
+ else:
+ return da.hstack((arr[:, :2], arr, arr[:, -5:], arr[:, -2:]))
def _get_coords_5km(self, scans):
y = np.arange(self.fscan_len * self.cscan_len) - 2
@@ -144,8 +147,19 @@ class ModisInterpolator():
x = (np.arange(self.fscan_full_width) - 2) % self.fscan_width
x[0] = -2
x[1] = -1
- x[-2] = 5
- x[-1] = 6
+ if self.cscan_full_width == 271:
+ x[-2] = 5
+ x[-1] = 6
+ elif self.cscan_full_width == 270:
+ x[-7] = 5
+ x[-6] = 6
+ x[-5] = 7
+ x[-4] = 8
+ x[-3] = 9
+ x[-2] = 10
+ x[-1] = 11
+ else:
+ raise NotImplementedError("Can't interpolate if 5km tiepoints have less than 270 columns.")
return x, y
def interpolate(self, lon1, lat1, satz1):
@@ -155,21 +169,13 @@ class ModisInterpolator():
fscan_width = self.fscan_width
fscan_len = self.fscan_len
- scans = lat1.shape[0] // cscan_len
- latattrs = lat1.attrs
- lonattrs = lon1.attrs
- dims = lat1.dims
- lat1 = lat1.data
- lon1 = lon1.data
+ scans = satz1.shape[0] // cscan_len
satz1 = satz1.data
- lat1 = lat1.reshape((-1, cscan_len, cscan_full_width))
- lon1 = lon1.reshape((-1, cscan_len, cscan_full_width))
satz1 = satz1.reshape((-1, cscan_len, cscan_full_width))
- lats_a, lats_b, lats_c, lats_d = get_corners(lat1)
- lons_a, lons_b, lons_c, lons_d = get_corners(lon1)
satz_a, satz_b, satz_c, satz_d = get_corners(da.deg2rad(satz1))
+
c_exp, c_ali = compute_expansion_alignment(satz_a, satz_b, satz_c, satz_d)
x, y = self.get_coords(scans)
@@ -190,24 +196,38 @@ class ModisInterpolator():
a_track = s_t
a_scan = (s_s + s_s * (1 - s_s) * c_exp_full + s_t*(1 - s_t) * c_ali_full)
- lats_a = self.expand_tiepoint_array(lats_a, lines, cols)
- lats_b = self.expand_tiepoint_array(lats_b, lines, cols)
- lats_c = self.expand_tiepoint_array(lats_c, lines, cols)
- lats_d = self.expand_tiepoint_array(lats_d, lines, cols)
- lons_a = self.expand_tiepoint_array(lons_a, lines, cols)
- lons_b = self.expand_tiepoint_array(lons_b, lines, cols)
- lons_c = self.expand_tiepoint_array(lons_c, lines, cols)
- lons_d = self.expand_tiepoint_array(lons_d, lines, cols)
+ res = []
+
+ sublat = lat1[::16, ::16]
+ sublon = lon1[::16, ::16]
+ to_cart = abs(sublat).max() > 60 or (sublon.max() - sublon.min()) > 180
- lats_1 = (1 - a_scan) * lats_a + a_scan * lats_b
- lats_2 = (1 - a_scan) * lats_d + a_scan * lats_c
- lats = (1 - a_track) * lats_1 + a_track * lats_2
+ if to_cart:
+ datasets = lonlat2xyz(lon1, lat1)
+ else:
+ datasets = [lon1, lat1]
- lons_1 = (1 - a_scan) * lons_a + a_scan * lons_b
- lons_2 = (1 - a_scan) * lons_d + a_scan * lons_c
- lons = (1 - a_track) * lons_1 + a_track * lons_2
+ for data in datasets:
+ data_attrs = data.attrs
+ dims = data.dims
+ data = data.data
+ data = data.reshape((-1, cscan_len, cscan_full_width))
+ data_a, data_b, data_c, data_d = get_corners(data)
+ data_a = self.expand_tiepoint_array(data_a, lines, cols)
+ data_b = self.expand_tiepoint_array(data_b, lines, cols)
+ data_c = self.expand_tiepoint_array(data_c, lines, cols)
+ data_d = self.expand_tiepoint_array(data_d, lines, cols)
- return xr.DataArray(lons, attrs=lonattrs, dims=dims), xr.DataArray(lats, attrs=latattrs, dims=dims)
+ data_1 = (1 - a_scan) * data_a + a_scan * data_b
+ data_2 = (1 - a_scan) * data_d + a_scan * data_c
+ data = (1 - a_track) * data_1 + a_track * data_2
+
+ res.append(xr.DataArray(data, attrs=data_attrs, dims=dims))
+
+ if to_cart:
+ return xyz2lonlat(*res)
+ else:
+ return res
def modis_1km_to_250m(lon1, lat1, satz1):
@@ -224,5 +244,22 @@ def modis_1km_to_500m(lon1, lat1, satz1):
def modis_5km_to_1km(lon1, lat1, satz1):
- interp = ModisInterpolator(5000, 1000)
+ interp = ModisInterpolator(5000, 1000, lon1.shape[1])
return interp.interpolate(lon1, lat1, satz1)
+
+def lonlat2xyz(lons, lats):
+ """Convert lons and lats to cartesian coordinates."""
+ R = 6370997.0
+ x_coords = R * da.cos(da.deg2rad(lats)) * da.cos(da.deg2rad(lons))
+ y_coords = R * da.cos(da.deg2rad(lats)) * da.sin(da.deg2rad(lons))
+ z_coords = R * da.sin(da.deg2rad(lats))
+ return x_coords, y_coords, z_coords
+
+def xyz2lonlat(x__, y__, z__):
+ """Get longitudes from cartesian coordinates.
+ """
+ R = 6370997.0
+ lons = da.rad2deg(da.arccos(x__ / da.sqrt(x__ ** 2 + y__ ** 2))) * da.sign(y__)
+ lats = da.sign(z__) * (90 - da.rad2deg(da.arcsin(da.sqrt(x__ ** 2 + y__ ** 2) / R)))
+
+ return lons, lats
=====================================
geotiepoints/tests/test_modisinterpolator.py
=====================================
@@ -63,6 +63,35 @@ class TestModisInterpolator(unittest.TestCase):
self.assertTrue(np.allclose(lon1, lons, atol=1e-2))
self.assertTrue(np.allclose(lat1, lats, atol=1e-2))
+ # Test level 2
+ lat5 = lat1[2::5, 2:-5:5]
+ lon5 = lon1[2::5, 2:-5:5]
+
+ satz5 = satz1[2::5, 2:-5:5]
+ lons, lats = modis_5km_to_1km(lon5, lat5, satz5)
+ self.assertTrue(np.allclose(lon1, lons, atol=1e-2))
+ self.assertTrue(np.allclose(lat1, lats, atol=1e-2))
+
+ def test_poles_datum(self):
+ import xarray as xr
+ h5f = h5py.File(FILENAME_DATA, 'r')
+ orig_lon = to_da(h5f['lon_1km'])
+ lon1 = orig_lon + 180
+ lon1 = xr.where(lon1 > 180, lon1 - 360, lon1)
+ lat1 = to_da(h5f['lat_1km'])
+ satz1 = to_da(h5f['satz_1km'])
+
+ lat5 = lat1[2::5, 2::5]
+ lon5 = lon1[2::5, 2::5]
+
+ satz5 = satz1[2::5, 2::5]
+ lons, lats = modis_5km_to_1km(lon5, lat5, satz5)
+ lons = lons + 180
+ lons = xr.where(lons > 180, lons - 360, lons)
+ self.assertTrue(np.allclose(orig_lon, lons, atol=1e-2))
+ self.assertTrue(np.allclose(lat1, lats, atol=1e-2))
+
+
def suite():
"""The suite for MODIS"""
loader = unittest.TestLoader()
=====================================
geotiepoints/version.py
=====================================
@@ -1,21 +1,520 @@
-# This file was generated by 'versioneer.py' (0.18) from
-# revision-control system data, or from the parent directory name of an
-# unpacked source archive. Distribution tarballs contain a pre-generated copy
-# of this file.
+# This file helps to compute a version number in source trees obtained from
+# git-archive tarball (such as those provided by githubs download-from-tag
+# feature). Distribution tarballs (built by setup.py sdist) and build
+# directories (produced by setup.py build) will contain a much shorter file
+# that just contains the computed version number.
-import json
+# This file is released into the public domain. Generated by
+# versioneer-0.18 (https://github.com/warner/python-versioneer)
-version_json = '''
-{
- "date": "2018-10-09T21:11:36+0200",
- "dirty": false,
- "error": null,
- "full-revisionid": "3f8d994a621a95562793c12149a1d86dfa546518",
- "version": "1.1.7"
-}
-''' # END VERSION_JSON
+"""Git implementation of _version.py."""
+
+import errno
+import os
+import re
+import subprocess
+import sys
+
+
+def get_keywords():
+ """Get the keywords needed to look up the version information."""
+ # these strings will be replaced by git during git-archive.
+ # 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 = " (tag: v1.1.8)"
+ git_full = "7c5cc8a887f8534cc2839c716c2c560aeaf77659"
+ git_date = "2019-04-24 19:57:25 +0200"
+ keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
+ return keywords
+
+
+class VersioneerConfig:
+ """Container for Versioneer configuration parameters."""
+
+
+def get_config():
+ """Create, populate and return the VersioneerConfig() object."""
+ # these strings are filled in when 'setup.py versioneer' creates
+ # _version.py
+ cfg = VersioneerConfig()
+ cfg.VCS = "git"
+ cfg.style = "pep440"
+ cfg.tag_prefix = "v"
+ cfg.parentdir_prefix = "None"
+ cfg.versionfile_source = "geotiepoints/version.py"
+ cfg.verbose = False
+ return cfg
+
+
+class NotThisMethod(Exception):
+ """Exception raised if a method is not valid for the current scenario."""
+
+
+LONG_VERSION_PY = {}
+HANDLERS = {}
+
+
+def register_vcs_handler(vcs, method): # decorator
+ """Decorator to mark a method as the handler for a particular VCS."""
+ def decorate(f):
+ """Store f in HANDLERS[vcs][method]."""
+ if vcs not in HANDLERS:
+ HANDLERS[vcs] = {}
+ HANDLERS[vcs][method] = f
+ return f
+ return decorate
+
+
+def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
+ env=None):
+ """Call the given command(s)."""
+ assert isinstance(commands, list)
+ p = None
+ for c in commands:
+ try:
+ dispcmd = str([c] + args)
+ # remember shell=False, so use git.cmd on windows, not just git
+ p = subprocess.Popen([c] + args, cwd=cwd, env=env,
+ stdout=subprocess.PIPE,
+ stderr=(subprocess.PIPE if hide_stderr
+ else None))
+ break
+ except EnvironmentError:
+ e = sys.exc_info()[1]
+ if e.errno == errno.ENOENT:
+ continue
+ if verbose:
+ print("unable to run %s" % dispcmd)
+ print(e)
+ return None, None
+ else:
+ if verbose:
+ print("unable to find command, tried %s" % (commands,))
+ return None, None
+ stdout = p.communicate()[0].strip()
+ if sys.version_info[0] >= 3:
+ stdout = stdout.decode()
+ if p.returncode != 0:
+ if verbose:
+ print("unable to run %s (error)" % dispcmd)
+ print("stdout was %s" % stdout)
+ return None, p.returncode
+ return stdout, p.returncode
+
+
+def versions_from_parentdir(parentdir_prefix, root, verbose):
+ """Try to determine the version from the parent directory name.
+
+ Source tarballs conventionally unpack into a directory that includes both
+ the project name and a version string. We will also support searching up
+ two directory levels for an appropriately named parent directory
+ """
+ rootdirs = []
+
+ for i in range(3):
+ dirname = os.path.basename(root)
+ if dirname.startswith(parentdir_prefix):
+ return {"version": dirname[len(parentdir_prefix):],
+ "full-revisionid": None,
+ "dirty": False, "error": None, "date": None}
+ else:
+ rootdirs.append(root)
+ root = os.path.dirname(root) # up a level
+
+ if verbose:
+ print("Tried directories %s but none started with prefix %s" %
+ (str(rootdirs), parentdir_prefix))
+ raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
+
+
+ at register_vcs_handler("git", "get_keywords")
+def git_get_keywords(versionfile_abs):
+ """Extract version information from the given file."""
+ # the code embedded in _version.py can just fetch the value of these
+ # keywords. When used from setup.py, we don't want to import _version.py,
+ # so we do it with a regexp instead. This function is not used from
+ # _version.py.
+ keywords = {}
+ try:
+ f = open(versionfile_abs, "r")
+ for line in f.readlines():
+ if line.strip().startswith("git_refnames ="):
+ mo = re.search(r'=\s*"(.*)"', line)
+ if mo:
+ keywords["refnames"] = mo.group(1)
+ if line.strip().startswith("git_full ="):
+ mo = re.search(r'=\s*"(.*)"', line)
+ if mo:
+ keywords["full"] = mo.group(1)
+ if line.strip().startswith("git_date ="):
+ mo = re.search(r'=\s*"(.*)"', line)
+ if mo:
+ keywords["date"] = mo.group(1)
+ f.close()
+ except EnvironmentError:
+ pass
+ return keywords
+
+
+ at register_vcs_handler("git", "keywords")
+def git_versions_from_keywords(keywords, tag_prefix, verbose):
+ """Get version information from git keywords."""
+ if not keywords:
+ raise NotThisMethod("no keywords at all, weird")
+ date = keywords.get("date")
+ if date is not None:
+ # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
+ # datestamp. However we prefer "%ci" (which expands to an "ISO-8601
+ # -like" string, which we must then edit to make compliant), because
+ # it's been around since git-1.5.3, and it's too difficult to
+ # discover which version we're using, or to work around using an
+ # older one.
+ date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
+ refnames = keywords["refnames"].strip()
+ if refnames.startswith("$Format"):
+ if verbose:
+ print("keywords are unexpanded, not using")
+ raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
+ refs = set([r.strip() for r in refnames.strip("()").split(",")])
+ # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
+ # just "foo-1.0". If we see a "tag: " prefix, prefer those.
+ TAG = "tag: "
+ tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)])
+ if not tags:
+ # Either we're using git < 1.8.3, or there really are no tags. We use
+ # a heuristic: assume all version tags have a digit. The old git %d
+ # expansion behaves like git log --decorate=short and strips out the
+ # refs/heads/ and refs/tags/ prefixes that would let us distinguish
+ # between branches and tags. By ignoring refnames without digits, we
+ # filter out many common branch names like "release" and
+ # "stabilization", as well as "HEAD" and "master".
+ tags = set([r for r in refs if re.search(r'\d', r)])
+ if verbose:
+ print("discarding '%s', no digits" % ",".join(refs - tags))
+ if verbose:
+ print("likely tags: %s" % ",".join(sorted(tags)))
+ for ref in sorted(tags):
+ # sorting will prefer e.g. "2.0" over "2.0rc1"
+ if ref.startswith(tag_prefix):
+ r = ref[len(tag_prefix):]
+ if verbose:
+ print("picking %s" % r)
+ return {"version": r,
+ "full-revisionid": keywords["full"].strip(),
+ "dirty": False, "error": None,
+ "date": date}
+ # no suitable tags, so version is "0+unknown", but full hex is still there
+ if verbose:
+ print("no suitable tags, using unknown + full revision id")
+ return {"version": "0+unknown",
+ "full-revisionid": keywords["full"].strip(),
+ "dirty": False, "error": "no suitable tags", "date": None}
+
+
+ at register_vcs_handler("git", "pieces_from_vcs")
+def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
+ """Get version from 'git describe' in the root of the source tree.
+
+ This only gets called if the git-archive 'subst' keywords were *not*
+ expanded, and _version.py hasn't already been rewritten with a short
+ version string, meaning we're inside a checked out source tree.
+ """
+ GITS = ["git"]
+ if sys.platform == "win32":
+ GITS = ["git.cmd", "git.exe"]
+
+ out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root,
+ hide_stderr=True)
+ if rc != 0:
+ if verbose:
+ print("Directory %s not under git control" % root)
+ raise NotThisMethod("'git rev-parse --git-dir' returned error")
+
+ # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
+ # if there isn't one, this yields HEX[-dirty] (no NUM)
+ describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty",
+ "--always", "--long",
+ "--match", "%s*" % tag_prefix],
+ cwd=root)
+ # --long was added in git-1.5.5
+ if describe_out is None:
+ raise NotThisMethod("'git describe' failed")
+ describe_out = describe_out.strip()
+ full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root)
+ if full_out is None:
+ raise NotThisMethod("'git rev-parse' failed")
+ full_out = full_out.strip()
+
+ pieces = {}
+ pieces["long"] = full_out
+ pieces["short"] = full_out[:7] # maybe improved later
+ pieces["error"] = None
+
+ # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
+ # TAG might have hyphens.
+ git_describe = describe_out
+
+ # look for -dirty suffix
+ dirty = git_describe.endswith("-dirty")
+ pieces["dirty"] = dirty
+ if dirty:
+ git_describe = git_describe[:git_describe.rindex("-dirty")]
+
+ # now we have TAG-NUM-gHEX or HEX
+
+ if "-" in git_describe:
+ # TAG-NUM-gHEX
+ mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe)
+ if not mo:
+ # unparseable. Maybe git-describe is misbehaving?
+ pieces["error"] = ("unable to parse git-describe output: '%s'"
+ % describe_out)
+ return pieces
+
+ # tag
+ full_tag = mo.group(1)
+ if not full_tag.startswith(tag_prefix):
+ if verbose:
+ fmt = "tag '%s' doesn't start with prefix '%s'"
+ print(fmt % (full_tag, tag_prefix))
+ pieces["error"] = ("tag '%s' doesn't start with prefix '%s'"
+ % (full_tag, tag_prefix))
+ return pieces
+ pieces["closest-tag"] = full_tag[len(tag_prefix):]
+
+ # distance: number of commits since tag
+ pieces["distance"] = int(mo.group(2))
+
+ # commit: short hex revision ID
+ pieces["short"] = mo.group(3)
+
+ else:
+ # HEX: no tags
+ pieces["closest-tag"] = None
+ count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"],
+ cwd=root)
+ pieces["distance"] = int(count_out) # total number of commits
+
+ # commit date: see ISO-8601 comment in git_versions_from_keywords()
+ date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"],
+ cwd=root)[0].strip()
+ pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
+
+ return pieces
+
+
+def plus_or_dot(pieces):
+ """Return a + if we don't already have one, else return a ."""
+ if "+" in pieces.get("closest-tag", ""):
+ return "."
+ return "+"
+
+
+def render_pep440(pieces):
+ """Build up version string, with post-release "local version identifier".
+
+ Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
+ get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
+
+ Exceptions:
+ 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
+ """
+ if pieces["closest-tag"]:
+ rendered = pieces["closest-tag"]
+ if pieces["distance"] or pieces["dirty"]:
+ rendered += plus_or_dot(pieces)
+ rendered += "%d.g%s" % (pieces["distance"], pieces["short"])
+ if pieces["dirty"]:
+ rendered += ".dirty"
+ else:
+ # exception #1
+ rendered = "0+untagged.%d.g%s" % (pieces["distance"],
+ pieces["short"])
+ if pieces["dirty"]:
+ rendered += ".dirty"
+ return rendered
+
+
+def render_pep440_pre(pieces):
+ """TAG[.post.devDISTANCE] -- No -dirty.
+
+ Exceptions:
+ 1: no tags. 0.post.devDISTANCE
+ """
+ if pieces["closest-tag"]:
+ rendered = pieces["closest-tag"]
+ if pieces["distance"]:
+ rendered += ".post.dev%d" % pieces["distance"]
+ else:
+ # exception #1
+ rendered = "0.post.dev%d" % pieces["distance"]
+ return rendered
+
+
+def render_pep440_post(pieces):
+ """TAG[.postDISTANCE[.dev0]+gHEX] .
+
+ The ".dev0" means dirty. Note that .dev0 sorts backwards
+ (a dirty tree will appear "older" than the corresponding clean one),
+ but you shouldn't be releasing software with -dirty anyways.
+
+ Exceptions:
+ 1: no tags. 0.postDISTANCE[.dev0]
+ """
+ if pieces["closest-tag"]:
+ rendered = pieces["closest-tag"]
+ if pieces["distance"] or pieces["dirty"]:
+ rendered += ".post%d" % pieces["distance"]
+ if pieces["dirty"]:
+ rendered += ".dev0"
+ rendered += plus_or_dot(pieces)
+ rendered += "g%s" % pieces["short"]
+ else:
+ # exception #1
+ rendered = "0.post%d" % pieces["distance"]
+ if pieces["dirty"]:
+ rendered += ".dev0"
+ rendered += "+g%s" % pieces["short"]
+ return rendered
+
+
+def render_pep440_old(pieces):
+ """TAG[.postDISTANCE[.dev0]] .
+
+ The ".dev0" means dirty.
+
+ Eexceptions:
+ 1: no tags. 0.postDISTANCE[.dev0]
+ """
+ if pieces["closest-tag"]:
+ rendered = pieces["closest-tag"]
+ if pieces["distance"] or pieces["dirty"]:
+ rendered += ".post%d" % pieces["distance"]
+ if pieces["dirty"]:
+ rendered += ".dev0"
+ else:
+ # exception #1
+ rendered = "0.post%d" % pieces["distance"]
+ if pieces["dirty"]:
+ rendered += ".dev0"
+ return rendered
+
+
+def render_git_describe(pieces):
+ """TAG[-DISTANCE-gHEX][-dirty].
+
+ Like 'git describe --tags --dirty --always'.
+
+ Exceptions:
+ 1: no tags. HEX[-dirty] (note: no 'g' prefix)
+ """
+ if pieces["closest-tag"]:
+ rendered = pieces["closest-tag"]
+ if pieces["distance"]:
+ rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
+ else:
+ # exception #1
+ rendered = pieces["short"]
+ if pieces["dirty"]:
+ rendered += "-dirty"
+ return rendered
+
+
+def render_git_describe_long(pieces):
+ """TAG-DISTANCE-gHEX[-dirty].
+
+ Like 'git describe --tags --dirty --always -long'.
+ The distance/hash is unconditional.
+
+ Exceptions:
+ 1: no tags. HEX[-dirty] (note: no 'g' prefix)
+ """
+ if pieces["closest-tag"]:
+ rendered = pieces["closest-tag"]
+ rendered += "-%d-g%s" % (pieces["distance"], pieces["short"])
+ else:
+ # exception #1
+ rendered = pieces["short"]
+ if pieces["dirty"]:
+ rendered += "-dirty"
+ return rendered
+
+
+def render(pieces, style):
+ """Render the given version pieces into the requested style."""
+ if pieces["error"]:
+ return {"version": "unknown",
+ "full-revisionid": pieces.get("long"),
+ "dirty": None,
+ "error": pieces["error"],
+ "date": None}
+
+ if not style or style == "default":
+ style = "pep440" # the default
+
+ if style == "pep440":
+ rendered = render_pep440(pieces)
+ elif style == "pep440-pre":
+ rendered = render_pep440_pre(pieces)
+ elif style == "pep440-post":
+ rendered = render_pep440_post(pieces)
+ elif style == "pep440-old":
+ rendered = render_pep440_old(pieces)
+ elif style == "git-describe":
+ rendered = render_git_describe(pieces)
+ elif style == "git-describe-long":
+ rendered = render_git_describe_long(pieces)
+ else:
+ raise ValueError("unknown style '%s'" % style)
+
+ return {"version": rendered, "full-revisionid": pieces["long"],
+ "dirty": pieces["dirty"], "error": None,
+ "date": pieces.get("date")}
def get_versions():
- return json.loads(version_json)
+ """Get version information or return default if unable to do so."""
+ # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
+ # __file__, we can work backwards from there to the root. Some
+ # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
+ # case we can only use expanded keywords.
+
+ cfg = get_config()
+ verbose = cfg.verbose
+
+ try:
+ return git_versions_from_keywords(get_keywords(), cfg.tag_prefix,
+ verbose)
+ except NotThisMethod:
+ pass
+
+ try:
+ root = os.path.realpath(__file__)
+ # versionfile_source is the relative path from the top of the source
+ # tree (where the .git directory might live) to this file. Invert
+ # this to find the root from __file__.
+ for i in cfg.versionfile_source.split('/'):
+ root = os.path.dirname(root)
+ except NameError:
+ return {"version": "0+unknown", "full-revisionid": None,
+ "dirty": None,
+ "error": "unable to find root of source tree",
+ "date": None}
+
+ try:
+ pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
+ return render(pieces, cfg.style)
+ except NotThisMethod:
+ pass
+
+ try:
+ if cfg.parentdir_prefix:
+ return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
+ except NotThisMethod:
+ pass
+
+ return {"version": "0+unknown", "full-revisionid": None,
+ "dirty": None,
+ "error": "unable to compute version", "date": None}
=====================================
python_geotiepoints.egg-info/PKG-INFO deleted
=====================================
@@ -1,17 +0,0 @@
-Metadata-Version: 1.2
-Name: python-geotiepoints
-Version: 1.1.7
-Summary: Interpolation of geographic tiepoints in Python
-Home-page: https://github.com/pytroll/python-geotiepoints
-Author: Adam Dybbroe, Martin Raspaud
-Author-email: martin.raspaud at smhi.se
-License: UNKNOWN
-Description: UNKNOWN
-Platform: UNKNOWN
-Classifier: Development Status :: 4 - Beta
-Classifier: Intended Audience :: Science/Research
-Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python
-Classifier: Topic :: Scientific/Engineering
-Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
=====================================
python_geotiepoints.egg-info/SOURCES.txt deleted
=====================================
@@ -1,56 +0,0 @@
-.gitattributes
-.gitignore
-.travis.yml
-CHANGELOG.md
-LICENSE.txt
-MANIFEST.in
-README.md
-RELEASING.md
-appveyor.yml
-changelog.rst
-mytest_fillborders.py
-mytest_modis5to1.py
-requirements.txt
-setup.cfg
-setup.py
-versioneer.py
-.github/ISSUE_TEMPLATE.md
-.github/PULL_REQUEST_TEMPLATE.md
-doc/Makefile
-doc/source/conf.py
-doc/source/index.rst
-doc/source/images/scatter_cartesian_distances.png
-doc/source/images/scatter_cartesian_distances_thumb.png
-doc/source/images/terra_20110821_1115_maspalomas_rednsow.png
-doc/source/images/terra_20110821_1115_maspalomas_rednsow_int.png
-doc/source/images/terra_20110821_1115_maspalomas_rednsow_int_thumb.png
-doc/source/images/terra_20110821_1115_rednsow.png
-doc/source/images/terra_20110821_1115_rednsow_int.png
-doc/source/images/terra_20110821_1115_rednsow_int_thumb.png
-geotiepoints/__init__.py
-geotiepoints/basic_interpolator.py
-geotiepoints/geointerpolator.py
-geotiepoints/interpolator.py
-geotiepoints/modisinterpolator.py
-geotiepoints/multilinear.py
-geotiepoints/multilinear_cython.c
-geotiepoints/multilinear_cython.pyx
-geotiepoints/version.py
-geotiepoints/tests/__init__.py
-geotiepoints/tests/test_geointerpolator.py
-geotiepoints/tests/test_interpolator.py
-geotiepoints/tests/test_modis.py
-geotiepoints/tests/test_modisinterpolator.py
-geotiepoints/tests/test_multilinear.py
-geotiepoints/tests/test_satelliteinterpolator.py
-python_geotiepoints.egg-info/PKG-INFO
-python_geotiepoints.egg-info/SOURCES.txt
-python_geotiepoints.egg-info/dependency_links.txt
-python_geotiepoints.egg-info/not-zip-safe
-python_geotiepoints.egg-info/requires.txt
-python_geotiepoints.egg-info/top_level.txt
-testdata/250m_lonlat_section_input.h5
-testdata/250m_lonlat_section_result.h5
-testdata/modis_test_data.h5
-testdata/test_5_to_1_geoloc_5km.h5
-testdata/test_5_to_1_geoloc_full.h5
\ No newline at end of file
=====================================
python_geotiepoints.egg-info/dependency_links.txt deleted
=====================================
@@ -1 +0,0 @@
-
=====================================
python_geotiepoints.egg-info/not-zip-safe deleted
=====================================
@@ -1 +0,0 @@
-
=====================================
python_geotiepoints.egg-info/requires.txt deleted
=====================================
@@ -1,3 +0,0 @@
-numpy
-scipy
-pandas
=====================================
python_geotiepoints.egg-info/top_level.txt deleted
=====================================
@@ -1 +0,0 @@
-geotiepoints
=====================================
setup.cfg
=====================================
@@ -1,15 +1,13 @@
[bdist_rpm]
-requires = numpy scipy pyresample
-release = 1
+requires=numpy scipy pyresample
+release=1
+
+[flake8]
+max-line-length = 120
[versioneer]
-vcs = git
+VCS = git
style = pep440
versionfile_source = geotiepoints/version.py
-versionfile_build =
+versionfile_build =
tag_prefix = v
-
-[egg_info]
-tag_build =
-tag_date = 0
-
=====================================
setup.py
=====================================
@@ -26,17 +26,11 @@
import os
import sys
-from distutils.extension import Extension
-#from Cython.Distutils import build_ext
-from setuptools import Extension, find_packages, setup
+from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext as _build_ext
import versioneer
-import imp
-version = imp.load_source('geotiepoints.version', 'geotiepoints/version.py')
-
-
requirements = ['numpy', 'scipy', 'pandas'],
# unittest2 is required by h5py 2.8.0rc:
test_requires = ['h5py', 'unittest2', 'xarray', 'dask']
@@ -74,6 +68,7 @@ def set_builtin(name, value):
else:
setattr(__builtins__, name, value)
+
cmdclass = versioneer.get_cmdclass()
versioneer_build_ext = cmdclass.get('build_ext', _build_ext)
@@ -95,6 +90,7 @@ class build_ext(versioneer_build_ext):
import numpy
self.include_dirs.append(numpy.get_include())
+
cmdclass['build_ext'] = build_ext
if __name__ == "__main__":
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-geotiepoints/commit/8d2734d1e3fbf0208e4ad24f926f0fbd6db26f01
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-geotiepoints/commit/8d2734d1e3fbf0208e4ad24f926f0fbd6db26f01
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190708/be915ee3/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list