Skip to content
Snippets Groups Projects
Unverified Commit ae4f1d76 authored by David Hoese's avatar David Hoese
Browse files

Fix L1b tests and add a few test files

parent 727f540f
No related branches found
No related tags found
1 merge request!1Add conda recipe
README 0 → 120000
README.md
\ No newline at end of file
......@@ -628,22 +628,33 @@ def goesr_to_fbf(filename):
rad.flush()
class tests(unittest.TestCase):
data_file = os.environ.get('TEST_DATA', os.path.expanduser("~/mnt/changeo/home/rayg/Data/test_data/goesr/awgonly/2017/020/OR_ABI-L1b-RadF-M3C12_G16_s20170200635589_e20170200646362_c20170200646413.nc"))
class TestPugL1bTools(unittest.TestCase):
def setUp(self):
pass
path = os.environ.get('TEST_DATA')
if not path or not os.path.isfile(path):
from pkg_resources import resource_filename
path = resource_filename('goesr', 'test_data/g16-abi-c08-radf-sample.nc')
if not path or not os.path.isfile(path):
raise EnvironmentError("Cannot find TEST_DATA or in-package test data")
self.data_file = path
def test_proj4_string(self):
t = PugFile(self.data_file)
t = PugL1bTools(self.data_file)
print(t.proj4_string)
def test_proj4(self):
t = PugFile(self.data_file)
t = PugL1bTools(self.data_file)
import pyproj
px = pyproj.Proj(t.proj4_string)
# convert the file shape index of 1500, 2000 to work with sparse files
x_idx = int(t.shape[1] / 5424. * 1500)
y_idx = int(t.shape[0] / 5424. * 2000)
# convert nadir-meters to lat/lon
lon, lat = px(t.proj_x[1500], t.proj_y[2000], inverse=True)
lon, lat = px(t.proj_x[x_idx], t.proj_y[y_idx], inverse=True)
# assume RadF
self.assertTrue(int(lon) == -113)
self.assertTrue(int(lat) == 13)
lopo = t.nav['longitude_of_projection_origin']
......@@ -652,12 +663,6 @@ class tests(unittest.TestCase):
self.assertTrue(x==y==0.0)
@staticmethod
def hello():
t = PugFile(tests.data_file)
return t
def _debug(type, value, tb):
"enable with sys.excepthook = debug"
if not sys.stdin.isatty():
......
......
......@@ -281,7 +281,8 @@ def sparsify(pvda, dimensions_matching:set=None, fill_after_extent:int=128, comp
nuxtent = min(fill_after_extent, extent)
D[name] = nuxtent
LOG.info('reducing {}[{}] {} -> {}'.format(p[-1], name, extent, nuxtent))
slices.append(slice(0, nuxtent))
slices.append(np.linspace(0, extent - 1, nuxtent).astype(np.int16))
# slices.append(slice(0, nuxtent))
slices = tuple(slices)
if v is not None:
LOG.info('slicing: {}'.format(repr(slices)))
......
......
File added
File added
......@@ -9,22 +9,15 @@ __author__ = 'rayg'
__docformat__ = 'reStructuredText'
from setuptools import setup, find_packages
setup(
name="goesr",
version="0.3",
version="0.4",
packages=find_packages(),
# scripts=['say_hello.py'],
# Project uses reStructuredText, so ensure that the docutils get
# installed or upgraded on the target machine
install_requires=['netCDF4', 'numpy', 'pyproj'],
# package_data={
# # If any package contains *.txt or *.rst files, include them:
# '': ['*.txt', '*.rst'],
# # And include any *.msg files found in the 'hello' package, too:
# 'hello': ['*.msg'],
# },
package_data={
'goesr': ['test_data/*.nc'],
},
# metadata for upload to PyPI
author="R.K.Garcia",
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment