diff --git a/test/scenario_1/GMAO/hydro.envi b/test/scenario_1/GMAO/hydro.envi
index feaf348a5..87196ab9d 100644
Binary files a/test/scenario_1/GMAO/hydro.envi and b/test/scenario_1/GMAO/hydro.envi differ
diff --git a/test/scenario_1/GMAO/hydro.hdr b/test/scenario_1/GMAO/hydro.hdr
index ef82c5600..9fd950e0e 100644
--- a/test/scenario_1/GMAO/hydro.hdr
+++ b/test/scenario_1/GMAO/hydro.hdr
@@ -1,4 +1,6 @@
ENVI
+description = {
+hydro.envi}
samples = 15
lines = 11
bands = 1
@@ -7,3 +9,6 @@ file type = ENVI Standard
data type = 4
interleave = bsq
byte order = 0
+band names = {
+Band 1}
+data ignore value = 0
diff --git a/test/scenario_1/GMAO/wet.envi b/test/scenario_1/GMAO/wet.envi
index fbe0981d3..bec021831 100644
Binary files a/test/scenario_1/GMAO/wet.envi and b/test/scenario_1/GMAO/wet.envi differ
diff --git a/test/scenario_1/GMAO/wet.hdr b/test/scenario_1/GMAO/wet.hdr
index ef82c5600..a141a6359 100644
--- a/test/scenario_1/GMAO/wet.hdr
+++ b/test/scenario_1/GMAO/wet.hdr
@@ -1,4 +1,6 @@
ENVI
+description = {
+wet.envi}
samples = 15
lines = 11
bands = 1
@@ -7,3 +9,6 @@ file type = ENVI Standard
data type = 4
interleave = bsq
byte order = 0
+band names = {
+Band 1}
+data ignore value = 0
diff --git a/test/scenario_3/S1_orbit_example.EOF b/test/scenario_3/S1_orbit_example.EOF
new file mode 100644
index 000000000..41e960e17
--- /dev/null
+++ b/test/scenario_3/S1_orbit_example.EOF
@@ -0,0 +1,136 @@
+
+
+
+
+ S1A_OPER_AUX_POEORB_OPOD_20181203T120749_V20181112T225942_20181114T005942
+ Precise Orbit Ephemerides (POE) Orbit File
+
+ Sentinel-1A
+ OPER
+ AUX_POEORB
+
+ UTC=2018-11-12T22:59:42
+ UTC=2018-11-14T00:59:42
+
+ 0001
+
+ OPOD
+ OPOD
+ 1.5.3
+ UTC=2018-12-03T12:07:49
+
+
+
+ EARTH_FIXED
+ UTC
+
+
+
+
+
+ TAI=2018-11-12T23:00:39.000000
+ UTC=2018-11-12T23:00:02.000000
+ UT1=2018-11-12T23:00:02.007459
+ +24561
+ -2064965.285362
+ 6434865.494987
+ 2090670.967443
+ 860.239634
+ 2590.964968
+ -7090.378144
+ NOMINAL
+
+
+ TAI=2018-11-12T23:00:49.000000
+ UTC=2018-11-12T23:00:12.000000
+ UT1=2018-11-12T23:00:12.007459
+ +24561
+ -2056228.553736
+ 6460407.492520
+ 2019650.417312
+ 887.072466
+ 2517.380329
+ -7113.598127
+ NOMINAL
+
+
+ TAI=2018-11-12T23:00:59.000000
+ UTC=2018-11-12T23:00:22.000000
+ UT1=2018-11-12T23:00:22.007459
+ +24561
+ -2047224.526705
+ 6485212.031660
+ 1948401.684024
+ 913.698134
+ 2443.474728
+ -7136.014344
+ NOMINAL
+
+
+ TAI=2018-11-12T23:01:09.000000
+ UTC=2018-11-12T23:00:32.000000
+ UT1=2018-11-12T23:00:32.007459
+ +24561
+ -2037955.293282
+ 6509275.946120
+ 1876932.818066
+ 940.113169
+ 2369.256838
+ -7157.624244
+ NOMINAL
+
+
+ TAI=2018-11-12T23:01:19.000000
+ UTC=2018-11-12T23:00:42.000000
+ UT1=2018-11-12T23:00:42.007459
+ +24561
+ -2028422.977002
+ 6532596.156540
+ 1805251.894958
+ 966.314136
+ 2294.735374
+ -7178.425371
+ NOMINAL
+
+
+ TAI=2018-11-12T23:01:29.000000
+ UTC=2018-11-12T23:00:52.000000
+ UT1=2018-11-12T23:00:52.007459
+ +24561
+ -2018629.735564
+ 6555169.670917
+ 1733367.014327
+ 992.297636
+ 2219.919093
+ -7198.415359
+ NOMINAL
+
+
+ TAI=2018-11-12T23:01:39.000000
+ UTC=2018-11-12T23:01:02.000000
+ UT1=2018-11-12T23:01:02.007459
+ +24561
+ -2008577.760461
+ 6576993.585012
+ 1661286.298987
+ 1018.060311
+ 2144.816789
+ -7217.591940
+ NOMINAL
+
+
+ TAI=2018-11-12T23:01:49.000000
+ UTC=2018-11-12T23:01:12.000000
+ UT1=2018-11-12T23:01:12.007458
+ +24561
+ -1998269.276601
+ 6598065.082739
+ 1589017.893976
+ 1043.598837
+ 2069.437298
+ -7235.952940
+ NOMINAL
+
+
+
+
diff --git a/test/scenario_3/S1_sv_file.txt b/test/scenario_3/S1_sv_file.txt
new file mode 100644
index 000000000..e99f09bfd
--- /dev/null
+++ b/test/scenario_3/S1_sv_file.txt
@@ -0,0 +1,8 @@
+-40.00 -2064965.285362 6434865.494987 2090670.967443 860.239634 2590.964968 -7090.378144
+-30.00 -2056228.553736 6460407.492520 2019650.417312 887.072466 2517.380329 -7113.598127
+-20.00 -2047224.526705 6485212.031660 1948401.684024 913.698134 2443.474728 -7136.014344
+-10.00 -2037955.293282 6509275.946120 1876932.818066 940.113169 2369.256838 -7157.624244
+0.00 -2028422.977002 6532596.156540 1805251.894958 966.314136 2294.735374 -7178.425371
+10.00 -2018629.735564 6555169.670917 1733367.014327 992.297636 2219.919093 -7198.415359
+20.00 -2008577.760461 6576993.585012 1661286.298987 1018.060311 2144.816789 -7217.591940
+30.00 -1998269.276601 6598065.082739 1589017.893976 1043.598837 2069.437298 -7235.952940
diff --git a/test/scenario_3/incorrect_file.txt b/test/scenario_3/incorrect_file.txt
new file mode 100644
index 000000000..54e2b78c2
--- /dev/null
+++ b/test/scenario_3/incorrect_file.txt
@@ -0,0 +1 @@
+this is a dummy file
diff --git a/test/test_checkArgs.py b/test/test_checkArgs.py
index a4da36982..c23c39ec0 100644
--- a/test/test_checkArgs.py
+++ b/test/test_checkArgs.py
@@ -22,12 +22,13 @@
def isWriteable(dirpath):
'''Test whether a directory is writeable'''
try:
- filehandle = open(os.path.join(dirpath, 'tmp.txt'), 'w' )
+ filehandle = open(os.path.join(dirpath, 'tmp.txt'), 'w')
filehandle.close()
return True
except IOError:
return False
-
+
+
@pytest.fixture
def parsed_args(tmp_path):
parser = RAiDER.runProgram.create_parser()
@@ -50,6 +51,7 @@ def test_checkArgs_outfmt_1(parsed_args):
checkArgs(args, p)
assert True
+
def test_checkArgs_outfmt_2(parsed_args):
'''Test that passing a raster format with height levels throws an error'''
args, p = parsed_args
@@ -58,6 +60,7 @@ def test_checkArgs_outfmt_2(parsed_args):
with pytest.raises(ValueError):
checkArgs(args, p)
+
def test_checkArgs_outfmt_3(parsed_args):
'''Test that passing a raster format with height levels throws an error'''
args, p = parsed_args
@@ -65,6 +68,7 @@ def test_checkArgs_outfmt_3(parsed_args):
argDict = checkArgs(args, p)
assert argDict['flag'] == 'station_file'
+
def test_checkArgs_outfmt_4(parsed_args):
'''Test that passing a raster format with height levels throws an error'''
args, p = parsed_args
@@ -72,6 +76,7 @@ def test_checkArgs_outfmt_4(parsed_args):
argDict = checkArgs(args, p)
assert argDict['flag'] == 'files'
+
def test_checkArgs_outloc_1(parsed_args):
'''Test that the default output and weather model directories are correct'''
args, p = parsed_args
@@ -81,6 +86,7 @@ def test_checkArgs_outloc_1(parsed_args):
assert os.path.abspath(out) == os.getcwd()
assert os.path.abspath(wmLoc) == os.path.join(os.getcwd(), 'weather_files')
+
def test_checkArgs_outloc_2(parsed_args, tmp_path):
'''Tests that the correct output location gets assigned when provided'''
with pushd(tmp_path):
@@ -90,6 +96,7 @@ def test_checkArgs_outloc_2(parsed_args, tmp_path):
out = argDict['out']
assert out == tmp_path
+
def test_checkArgs_outloc_2b(parsed_args, tmp_path):
''' Tests that the weather model directory gets passed through by itself'''
with pushd(tmp_path):
@@ -99,12 +106,14 @@ def test_checkArgs_outloc_2b(parsed_args, tmp_path):
argDict = checkArgs(args, p)
assert argDict['wmLoc'] == 'weather_dir'
+
def test_checkArgs_outloc_3(parsed_args):
'''Tests that the weather model directory gets created when needed'''
args, p = parsed_args
argDict = checkArgs(args, p)
assert os.path.isdir(argDict['wmLoc'])
+
def test_checkArgs_outloc_4(parsed_args):
'''Tests for creating writeable weather model directory'''
args, p = parsed_args
@@ -112,6 +121,7 @@ def test_checkArgs_outloc_4(parsed_args):
assert isWriteable(argDict['wmLoc'])
+
def test_ll_bounds_1(parsed_args):
'''Tests that lats out of bounds raises error'''
args, p = parsed_args
@@ -119,6 +129,7 @@ def test_ll_bounds_1(parsed_args):
with pytest.raises(ValueError):
checkArgs(args, p)
+
def test_ll_bounds_2(parsed_args):
'''Tests that lats out of bounds raises error'''
args, p = parsed_args
@@ -126,6 +137,7 @@ def test_ll_bounds_2(parsed_args):
with pytest.raises(ValueError):
checkArgs(args, p)
+
def test_los_1(parsed_args):
'''Tests that lats out of bounds raises error'''
args, p = parsed_args
@@ -134,6 +146,7 @@ def test_los_1(parsed_args):
assert argDict['los'][0] == 'los'
assert argDict['los'][1] == 'los.rdr'
+
def test_los_2(parsed_args):
'''Tests that lats out of bounds raises error'''
args, p = parsed_args
@@ -142,12 +155,14 @@ def test_los_2(parsed_args):
assert argDict['los'][0] == 'sv'
assert argDict['los'][1] == 'sv.txt'
+
def test_los_3(parsed_args):
'''Tests that lats out of bounds raises error'''
args, p = parsed_args
argDict = checkArgs(args, p)
assert argDict['los'] == Zenith
+
def test_models_1a(parsed_args):
'''Tests that the weather model gets passed through correctly'''
args, p = parsed_args
@@ -155,6 +170,7 @@ def test_models_1a(parsed_args):
assert argDict['weather_model']['type'].Model() == 'ERA-5'
assert argDict['weather_model']['name'] == 'era5'
+
def test_models_1b(parsed_args):
'''Tests that the weather model gets passed through correctly'''
args, p = parsed_args
@@ -163,6 +179,7 @@ def test_models_1b(parsed_args):
assert argDict['weather_model']['type'].Model() == 'HRRR'
assert argDict['weather_model']['name'] == 'hrrr'
+
def test_models_1c(parsed_args):
'''Tests that the weather model gets passed through correctly'''
args, p = parsed_args
@@ -171,6 +188,7 @@ def test_models_1c(parsed_args):
assert argDict['weather_model']['type'].Model() == 'NCMR'
assert argDict['weather_model']['name'] == 'ncmr'
+
def test_models_1d(parsed_args):
'''Tests that the weather model gets passed through correctly'''
args, p = parsed_args
@@ -179,6 +197,7 @@ def test_models_1d(parsed_args):
assert argDict['weather_model']['type'].Model() == 'ERA-5'
assert argDict['weather_model']['name'] == 'era5'
+
def test_models_1e(parsed_args):
'''Tests that the weather model gets passed through correctly'''
args, p = parsed_args
@@ -187,6 +206,7 @@ def test_models_1e(parsed_args):
assert argDict['weather_model']['type'].Model() == 'ERA-5'
assert argDict['weather_model']['name'] == 'era5'
+
def test_models_1f(parsed_args):
'''Tests that the weather model gets passed through correctly'''
args, p = parsed_args
@@ -195,6 +215,7 @@ def test_models_1f(parsed_args):
assert argDict['weather_model']['type'].Model() == 'ERA-5'
assert argDict['weather_model']['name'] == 'era5'
+
def test_models_2(parsed_args):
'''Tests that unknown weather models get rejected'''
args, p = parsed_args
@@ -202,6 +223,7 @@ def test_models_2(parsed_args):
with pytest.raises(NotImplementedError):
checkArgs(args, p)
+
def test_models_3a(parsed_args):
'''Tests that WRF weather models requires files'''
args, p = parsed_args
@@ -209,6 +231,7 @@ def test_models_3a(parsed_args):
with pytest.raises(RuntimeError):
checkArgs(args, p)
+
def test_models_3b(parsed_args):
'''Tests that HDF5 weather models requires files'''
args, p = parsed_args
@@ -216,6 +239,7 @@ def test_models_3b(parsed_args):
with pytest.raises(RuntimeError):
checkArgs(args, p)
+
def test_models_3c(parsed_args):
'''Tests that WRF weather models requires files'''
args, p = parsed_args
@@ -224,12 +248,14 @@ def test_models_3c(parsed_args):
argDict = checkArgs(args, p)
assert True
+
def test_zref_1(parsed_args):
'''tests that default zref gets generated'''
args, p = parsed_args
argDict = checkArgs(args, p)
assert argDict['zref'] == _ZREF
+
def test_zref_2(parsed_args):
'''tests that default zref gets generated'''
ztest = 20000
@@ -238,11 +264,13 @@ def test_zref_2(parsed_args):
argDict = checkArgs(args, p)
assert argDict['zref'] == ztest
+
def test_parallel_1(parsed_args):
'''tests that parallel options are handled correctly'''
args, p = parsed_args
argDict = checkArgs(args, p)
- assert argDict['parallel'] == 1
+ assert argDict['parallel'] == 1
+
def test_parallel_2(parsed_args):
'''tests that parallel options are handled correctly'''
@@ -251,12 +279,14 @@ def test_parallel_2(parsed_args):
argDict = checkArgs(args, p)
assert argDict['parallel'] == mp.cpu_count()
+
def test_parallel_3(parsed_args):
'''tests that parallel options are handled correctly'''
args, p = parsed_args
args.parallel = 2
argDict = checkArgs(args, p)
- assert argDict['parallel'] == 2
+ assert argDict['parallel'] == 2
+
def test_parallel_4(parsed_args):
'''tests that parallel options are handled correctly'''
@@ -265,12 +295,14 @@ def test_parallel_4(parsed_args):
argDict = checkArgs(args, p)
assert argDict['parallel'] == mp.cpu_count()
+
def test_verbose_1(parsed_args):
'''tests that verbose option is handled correctly'''
args, p = parsed_args
argDict = checkArgs(args, p)
assert not argDict['verbose']
+
def test_verbose_2(parsed_args):
'''tests that verbose option is handled correctly'''
args, p = parsed_args
@@ -278,12 +310,14 @@ def test_verbose_2(parsed_args):
argDict = checkArgs(args, p)
assert argDict['verbose']
+
def test_download_only_1(parsed_args):
'''tests that the download-only option is handled correctly'''
args, p = parsed_args
argDict = checkArgs(args, p)
assert not argDict['download_only']
+
def test_download_only_2(parsed_args):
'''tests that the download-only option is handled correctly'''
args, p = parsed_args
@@ -291,11 +325,13 @@ def test_download_only_2(parsed_args):
argDict = checkArgs(args, p)
assert argDict['download_only']
+
def test_useWeatherNodes_1(parsed_args):
'''tests that the correct flag gets passed'''
args, p = parsed_args
argDict = checkArgs(args, p)
- assert argDict['flag'] == 'bounding_box'# default arguments use a bounding box
+ assert argDict['flag'] == 'bounding_box' # default arguments use a bounding box
+
def test_filenames_1(parsed_args):
'''tests that the correct filenames are generated'''
@@ -308,6 +344,7 @@ def test_filenames_1(parsed_args):
assert '20200103' in argDict['hydroFilenames'][0]
assert len(argDict['hydroFilenames']) == 1
+
def test_filenames_2(parsed_args):
'''tests that the correct filenames are generated'''
args, p = parsed_args
@@ -317,14 +354,17 @@ def test_filenames_2(parsed_args):
assert '20200103' in argDict['wetFilenames'][0]
assert len(argDict['wetFilenames']) == 1
+
def test_makeDelayFileNames_1():
assert makeDelayFileNames(None, None, "h5", "name", "dir") == \
("dir/name_wet_ztd.h5", "dir/name_hydro_ztd.h5")
+
def test_makeDelayFileNames_2():
assert makeDelayFileNames(None, (), "h5", "name", "dir") == \
("dir/name_wet_std.h5", "dir/name_hydro_std.h5")
+
def test_makeDelayFileNames_3():
assert makeDelayFileNames(datetime.datetime(2020, 1, 1, 1, 2, 3), None, "h5", "model_name", "dir") == \
(
@@ -332,6 +372,7 @@ def test_makeDelayFileNames_3():
"dir/model_name_hydro_20200101T010203_ztd.h5"
)
+
def test_makeDelayFileNames_4():
assert makeDelayFileNames(datetime.datetime(1900, 12, 31, 1, 2, 3), "los", "h5", "model_name", "dir") == \
(
@@ -339,10 +380,12 @@ def test_makeDelayFileNames_4():
"dir/model_name_hydro_19001231T010203_std.h5"
)
+
def test_model2module():
model_module_name, model_obj = modelName2Module('ERA5')
assert model_obj().Model() == 'ERA-5'
+
def test_dem_1(parsed_args):
'''Test that passing a raster format with height levels throws an error'''
args, p = parsed_args
@@ -350,6 +393,7 @@ def test_dem_1(parsed_args):
assert argDict['heights'][0] == 'skip'
assert argDict['heights'][1] is None
+
def test_dem_2(parsed_args):
'''Test that passing a raster format with height levels throws an error'''
args, p = parsed_args
@@ -358,6 +402,7 @@ def test_dem_2(parsed_args):
assert argDict['heights'][0] == 'lvs'
assert np.allclose(argDict['heights'][1], [10, 100, 1000])
+
def test_dem_3(parsed_args):
'''Test that passing a raster format with height levels throws an error'''
args, p = parsed_args
@@ -367,6 +412,7 @@ def test_dem_3(parsed_args):
assert argDict['heights'][0] == 'lvs'
assert np.allclose(argDict['heights'][1], [10, 100, 1000])
+
def test_dem_4(parsed_args):
'''Test that passing a raster format with height levels throws an error'''
args, p = parsed_args
@@ -375,6 +421,7 @@ def test_dem_4(parsed_args):
assert argDict['heights'][0] == 'pandas'
assert argDict['heights'][1][0] == argDict['wetFilenames'][0]
+
def test_dem_5(parsed_args):
'''Test that passing a raster format with height levels throws an error'''
args, p = parsed_args
@@ -382,4 +429,3 @@ def test_dem_5(parsed_args):
argDict = checkArgs(args, p)
assert argDict['heights'][0] == 'download'
assert argDict['heights'][1] == os.path.join(argDict['out'], 'geom', 'warpedDEM.dem')
-
diff --git a/test/test_losreader.py b/test/test_losreader.py
new file mode 100644
index 000000000..3a2b3fb92
--- /dev/null
+++ b/test/test_losreader.py
@@ -0,0 +1,253 @@
+import datetime
+import os
+import pytest
+from test import TEST_DIR
+
+import numpy as np
+
+from RAiDER.losreader import (
+ read_ESA_Orbit_file,
+ read_txt_file,
+ cut_times,
+ inc_hd_to_enu,
+ get_sv,
+ getZenithLookVecs,
+)
+
+SCENARIO_DIR = os.path.join(TEST_DIR, "scenario_3")
+
+
+@pytest.fixture
+def svs():
+ ref_time = datetime.datetime(2018, 11, 12, 23, 0, 42)
+ T = [
+ datetime.datetime(2018, 11, 12, 23, 0, 2),
+ datetime.datetime(2018, 11, 12, 23, 0, 12),
+ datetime.datetime(2018, 11, 12, 23, 0, 22),
+ datetime.datetime(2018, 11, 12, 23, 0, 32),
+ datetime.datetime(2018, 11, 12, 23, 0, 42),
+ datetime.datetime(2018, 11, 12, 23, 0, 52),
+ datetime.datetime(2018, 11, 12, 23, 1, 2),
+ datetime.datetime(2018, 11, 12, 23, 1, 12),
+ ]
+ tr = np.array([(t - ref_time).total_seconds() for t in T])
+ x = np.array([
+ -2064965.285362,
+ -2056228.553736,
+ -2047224.526705,
+ -2037955.293282,
+ -2028422.977002,
+ -2018629.735564,
+ -2008577.760461,
+ -1998269.276601,
+ ])
+ y = np.array([
+ 6434865.494987,
+ 6460407.492520,
+ 6485212.031660,
+ 6509275.946120,
+ 6532596.156540,
+ 6555169.670917,
+ 6576993.585012,
+ 6598065.082739,
+ ])
+ z = np.array([
+ 2090670.967443,
+ 2019650.417312,
+ 1948401.684024,
+ 1876932.818066,
+ 1805251.894958,
+ 1733367.014327,
+ 1661286.298987,
+ 1589017.893976,
+ ])
+ vx = np.array([
+ 860.239634,
+ 887.072466,
+ 913.698134,
+ 940.113169,
+ 966.314136,
+ 992.297636,
+ 1018.060311,
+ 1043.598837,
+ ])
+ vy = np.array([
+ 2590.964968,
+ 2517.380329,
+ 2443.474728,
+ 2369.256838,
+ 2294.735374,
+ 2219.919093,
+ 2144.816789,
+ 2069.437298,
+ ])
+ vz = np.array([
+ -7090.378144,
+ -7113.598127,
+ -7136.014344,
+ -7157.624244,
+ -7178.425371,
+ -7198.415359,
+ -7217.591940,
+ -7235.952940,
+ ])
+ return [tr, x, y, z, vx, vy, vz], ref_time
+
+
+def test_read_ESA_Orbit_file(svs):
+ true_svs, ref_time = svs
+ filename = os.path.join(SCENARIO_DIR, 'S1_orbit_example.EOF')
+ svs = read_ESA_Orbit_file(filename, ref_time)
+ assert [np.allclose(s, ts) for s, ts in zip(svs, true_svs)]
+
+
+def test_read_txt_file(svs):
+ true_svs, ref_time = svs
+ filename = os.path.join(SCENARIO_DIR, 'S1_sv_file.txt')
+ svs = read_txt_file(filename)
+ assert [np.allclose(s, ts) for s, ts in zip(svs, true_svs)]
+
+
+def test_get_sv_1(svs):
+ true_svs, ref_time = svs
+ filename = os.path.join(SCENARIO_DIR, 'S1_orbit_example.EOF')
+ svs = get_sv(filename, ref_time)
+ assert [np.allclose(s, ts) for s, ts in zip(svs, true_svs)]
+
+
+def test_get_sv_2(svs):
+ true_svs, ref_time = svs
+ filename = os.path.join(SCENARIO_DIR, 'S1_sv_file.txt')
+ svs = get_sv(filename, ref_time)
+ assert [np.allclose(s, ts) for s, ts in zip(svs, true_svs)]
+
+
+def test_get_sv_3(svs):
+ true_svs, ref_time = svs
+ filename = os.path.join(SCENARIO_DIR, 'incorrect_file.txt')
+ with pytest.raises(ValueError):
+ get_sv(filename, ref_time)
+
+
+def test_get_sv_4(svs):
+ true_svs, ref_time = svs
+ filename = os.path.join(SCENARIO_DIR, 'no_exist.txt')
+ with pytest.raises(FileNotFoundError):
+ get_sv(filename, ref_time)
+
+
+def test_cut_times(svs):
+ true_svs, ref_time = svs
+ assert len(true_svs[0][cut_times(true_svs[0])]) == len(true_svs[0])
+
+
+def test_cut_times_2(svs):
+ true_svs, ref_time = svs
+ assert len(true_svs[0][cut_times(true_svs[0], pad=5)]) == 1
+
+
+def test_cut_times_3(svs):
+ true_svs, ref_time = svs
+ assert len(true_svs[0][cut_times(true_svs[0], pad=15)]) == 3
+
+
+def test_cut_times_4(svs):
+ true_svs, ref_time = svs
+
+ assert len(true_svs[0][cut_times(true_svs[0], pad=400)]) == len(true_svs[0])
+
+
+def test_los_to_lv():
+ with pytest.raises(ValueError):
+ inc_hd_to_enu(-10, 0)
+
+
+def test_los_to_lv_2():
+ assert np.allclose(
+ inc_hd_to_enu(0, 0),
+ np.array([0, 0, 1])
+ )
+
+
+def test_los_to_lv_3():
+ assert np.allclose(
+ inc_hd_to_enu(0, -180),
+ np.array([0, 0, 1])
+ )
+
+
+def test_los_to_lv_3b():
+ assert np.allclose(
+ inc_hd_to_enu(0, 18),
+ np.array([0, 0, 1])
+ )
+
+
+def test_los_to_lv_3c():
+ assert np.allclose(
+ inc_hd_to_enu(0, -18),
+ np.array([0, 0, 1])
+ )
+
+
+def test_los_to_lv_4():
+ assert np.allclose(
+ inc_hd_to_enu(35, 0),
+ np.array([0, np.sin(np.radians(35)), np.cos(np.radians(35))])
+ )
+
+
+def test_los_to_lv_5():
+ assert np.allclose(
+ inc_hd_to_enu(35, 180),
+ np.array([0, -np.sin(np.radians(35)), np.cos(np.radians(35))])
+ )
+
+
+def test_los_to_lv_6():
+ assert np.allclose(
+ inc_hd_to_enu(35, 90),
+ np.array([-np.sin(np.radians(35)), 0, np.cos(np.radians(35))])
+ )
+
+
+def test_zenith_1():
+ assert np.allclose(
+ getZenithLookVecs(np.array([0]), np.array([0]), np.array([0])),
+ np.array([1, 0, 0])
+ )
+
+
+def test_zenith_2():
+ assert np.allclose(
+ getZenithLookVecs(np.array([90]), np.array([0]), np.array([0])),
+ np.array([0, 0, 1])
+ )
+
+
+def test_zenith_3():
+ assert np.allclose(
+ getZenithLookVecs(np.array([-90]), np.array([0]), np.array([0])),
+ np.array([0, 0, -1])
+ )
+
+
+def test_zenith_4():
+ assert np.allclose(
+ getZenithLookVecs(np.array([0]), np.array([180]), np.array([0])),
+ np.array([-1, 0, 0])
+ )
+
+
+def test_zenith_5():
+ assert np.allclose(
+ getZenithLookVecs(np.array([0]), np.array([90]), np.array([0])),
+ np.array([0, 1, 0])
+ )
+
+
+def test_zenith_6():
+ assert np.allclose(
+ getZenithLookVecs(np.array([0]), np.array([0]), np.array([1000])),
+ np.array([1, 0, 0])
+ )
diff --git a/test/test_scenario_1.py b/test/test_scenario_1.py
index 0386b04aa..eed6aa56c 100755
--- a/test/test_scenario_1.py
+++ b/test/test_scenario_1.py
@@ -5,7 +5,7 @@
import numpy as np
-from test import DATA_DIR, TEST_DIR, pushd
+from test import TEST_DIR, pushd
from RAiDER.constants import Zenith
@@ -44,15 +44,6 @@ def test_tropo_delay_ERA5T(tmp_path):
core_test_tropo_delay(tmp_path, modelName="ERA5T")
-@pytest.mark.timeout(600)
-def test_tropo_delay_HRES(tmp_path):
- '''
- Scenario:
- 1: Small area, HRES, Zenith delay
- '''
- core_test_tropo_delay(tmp_path, modelName="HRES")
-
-
@pytest.mark.timeout(600)
def test_tropo_delay_GMAO(tmp_path):
'''
@@ -149,5 +140,5 @@ def core_test_tropo_delay(tmp_path, modelName):
)
# get the true delay from the weather model
- assert np.nanmax(np.abs((wet - true_wet) / true_wet )) < _RTOL
- assert np.nanmax(np.abs((hydro - true_hydro) / true_hydro )) < _RTOL
+ assert np.nanmax(np.abs((wet - true_wet) / true_wet)) < _RTOL
+ assert np.nanmax(np.abs((hydro - true_hydro) / true_hydro)) < _RTOL
diff --git a/test/test_scenario_2.py b/test/test_scenario_2.py
index 3fb688340..dc7bfe1e0 100644
--- a/test/test_scenario_2.py
+++ b/test/test_scenario_2.py
@@ -5,7 +5,7 @@
import pandas as pd
import pytest
from shutil import copyfile
-from test import DATA_DIR, TEST_DIR, pushd
+from test import TEST_DIR, pushd
from RAiDER.constants import Zenith
from RAiDER.delay import tropo_delay
@@ -67,15 +67,5 @@ def test_computeDelay(tmp_path):
true_delay = pd.read_csv(true_delay)
# get the true delay from the weather model
- assert np.allclose(
- est_delay['wetDelay'].values,
- true_delay['wetDelay'].values,
- equal_nan=True,
- rtol = _RTOL,
- )
- assert np.allclose(
- est_delay['hydroDelay'].values,
- true_delay['hydroDelay'].values,
- equal_nan=True,
- rtol = _RTOL,
- )
+ assert np.sum((est_delay['wetDelay'].values - true_delay['wetDelay'].values) / true_delay['wetDelay'].values) < _RTOL
+ assert np.sum((est_delay['hydroDelay'].values - true_delay['hydroDelay'].values) / true_delay['hydroDelay'].values) < _RTOL
diff --git a/test/test_util.py b/test/test_util.py
index da3567614..12f5b4e90 100644
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -12,10 +12,12 @@
from RAiDER.utilFcns import (
_least_nonzero, cosd, gdal_open, sind,
writeArrayToRaster, writeResultsToHDF5, gdal_extents,
- getTimeFromFile
+ getTimeFromFile, enu2ecef, ecef2enu, lla2ecef,
)
+_R_EARTH = 6378138
+
SCENARIO_DIR = os.path.join(TEST_DIR, "scenario_1")
@@ -335,11 +337,115 @@ def test_WGS84_to_UTM():
@pytest.mark.skipif(True, reason='Need to ensure this file always get written before this executes')
def test_read_weather_model_file():
weather_model_obj = read_wm_file(
- os.path.join(
- SCENARIO_DIR,
- 'weather_files',
- 'ERA5_2020_01_03_T23_00_00_15.75N_18.25N_103.24W_99.75W.nc'
- )
+ os.path.join(
+ SCENARIO_DIR,
+ 'weather_files',
+ 'ERA5_2020_01_03_T23_00_00_15.75N_18.25N_103.24W_99.75W.nc'
)
+ )
assert weather_model_obj.Model() == 'ERA-5'
+
+def test_enu2ecef_1():
+ enu = np.array([0, 0, 1])
+ llh = np.array([0, 0, 0])
+ ecef = enu2ecef(enu[0], enu[1], enu[2], llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([1, 0, 0]))
+
+
+def test_enu2ecef_2():
+ enu = np.array([0, 0, 1])
+ llh = np.array([0, 90, 0])
+ ecef = enu2ecef(enu[0], enu[1], enu[2], llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, 1, 0]))
+
+
+def test_enu2ecef_3():
+ enu = np.array([0, 0, 1])
+ llh = np.array([0, -90, 0])
+ ecef = enu2ecef(enu[0], enu[1], enu[2], llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, -1, 0]))
+
+
+def test_enu2ecef_4():
+ enu = np.array([0, 0, 1])
+ llh = np.array([90, 0, 0])
+ ecef = enu2ecef(enu[0], enu[1], enu[2], llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, 0, 1]))
+
+
+def test_enu2ecef_5():
+ enu = np.array([0, 0, 1])
+ llh = np.array([-90, 0, 0])
+ ecef = enu2ecef(enu[0], enu[1], enu[2], llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, 0, -1]))
+
+
+def test_enu2ecef_6():
+ enu = np.array([0, 1, 0])
+ llh = np.array([0, 0, 0])
+ ecef = enu2ecef(enu[0], enu[1], enu[2], llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, 0, 1]))
+
+
+def test_ecef2enu_1():
+ enu = np.array([0, 0, 1])
+ llh = np.array([0, 0, 0])
+ enu = ecef2enu(enu, llh[0], llh[1], llh[2])
+ assert np.allclose(enu, np.array([0, 1, 0]))
+
+
+def test_ecef2enu_2():
+ enu = np.array([0, 0, 1])
+ llh = np.array([0, 90, 0])
+ ecef = ecef2enu(enu, llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, 1, 0]))
+
+
+def test_ecef2enu_3():
+ enu = np.array([0, 0, 1])
+ llh = np.array([0, -90, 0])
+ ecef = ecef2enu(enu, llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, 1, 0]))
+
+
+def test_ecef2enu_4():
+ enu = np.array([0, 0, 1])
+ llh = np.array([90, 0, 0])
+ ecef = ecef2enu(enu, llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, 0, 1]))
+
+
+def test_ecef2enu_5():
+ enu = np.array([0, 0, 1])
+ llh = np.array([-90, 0, 0])
+ ecef = ecef2enu(enu, llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, 0, -1]))
+
+
+def test_ecef2enu_6():
+ enu = np.array([0, 0, -1])
+ llh = np.array([0, -180, 0])
+ ecef = ecef2enu(enu, llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, -1, 0]))
+
+
+def test_ecef2enu_7():
+ enu = np.array([0, 0, 1])
+ llh = np.array([0, -180, 1000])
+ ecef = ecef2enu(enu, llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([0, 1, 0]))
+
+
+def test_ecef2enu_8():
+ enu = np.array([1, 1, 0])
+ llh = np.array([0, 0, 0])
+ ecef = ecef2enu(enu, llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([1, 0, 1]))
+
+
+def test_ecef2enu_9():
+ enu = np.array([1, 1, 0])
+ llh = np.array([0, 180, 0])
+ ecef = ecef2enu(enu, llh[0], llh[1], llh[2])
+ assert np.allclose(ecef, np.array([-1, 0, -1]))
diff --git a/test/weather_model/test_weather_model.py b/test/weather_model/test_weather_model.py
index cc1ceca34..702f117aa 100644
--- a/test/weather_model/test_weather_model.py
+++ b/test/weather_model/test_weather_model.py
@@ -151,7 +151,7 @@ def test_uniform_in_z_small(model):
model._p = np.arange(8).reshape(2, 2, 2)
model._t = model._p * 2
model._e = model._p * 3
- model._lats = model._zs # for now just passing in dummy arrays for lats, lons
+ model._lats = model._zs # for now just passing in dummy arrays for lats, lons
model._lons = model._zs
model._uniform_in_z()
@@ -188,7 +188,7 @@ def test_uniform_in_z_large(model):
model._p = np.tile(np.arange(y).reshape(-1, 1) * np.ones(z), (x, 1, 1))
model._t = model._p * 2
model._e = model._p * 3
- model._lats = model._zs # for now just passing in dummy arrays for lats, lons
+ model._lats = model._zs # for now just passing in dummy arrays for lats, lons
model._lons = model._zs
assert model._p.shape == shape
diff --git a/tools/RAiDER/checkArgs.py b/tools/RAiDER/checkArgs.py
index 41e76ca48..44b0333c7 100644
--- a/tools/RAiDER/checkArgs.py
+++ b/tools/RAiDER/checkArgs.py
@@ -222,5 +222,3 @@ def modelName2Module(model_name):
model_module = importlib.import_module(module_name)
wmObject = getattr(model_module, model_name.upper().replace('-', ''))
return module_name, wmObject
-
-
diff --git a/tools/RAiDER/constants.py b/tools/RAiDER/constants.py
index 89260d036..86d504db5 100644
--- a/tools/RAiDER/constants.py
+++ b/tools/RAiDER/constants.py
@@ -18,6 +18,7 @@
R_EARTH_MAX = 6378137
R_EARTH_MIN = 6356752
+
class Zenith:
"""Special value indicating a look vector of "zenith"."""
pass
diff --git a/tools/RAiDER/delay.py b/tools/RAiDER/delay.py
index 6b4a0cdd1..d93cc0956 100755
--- a/tools/RAiDER/delay.py
+++ b/tools/RAiDER/delay.py
@@ -34,8 +34,8 @@ def computeDelay(
out=None,
):
"""
- Calculate troposphere delay using a weather model file and query
- points file.
+ Calculate troposphere delay using a weather model file and query
+ points file.
"""
logger.debug('Beginning delay calculation')
logger.debug('Max integration height is {:1.1f} m'.format(zref))
@@ -170,10 +170,10 @@ def tropo_delay(args):
logger.debug('Beginning line-of-sight calculation')
# Convert the line-of-sight inputs to look vectors
- los = getLookVectors(los, lats, lons, hgts, zref)
+ los, lengths = getLookVectors(los, lats, lons, hgts, zref=zref, time=time)
# write to an HDF5 file
- writePnts2HDF5(lats, lons, hgts, los, outName=pnts_file)
+ writePnts2HDF5(lats, lons, hgts, los, lengths, outName=pnts_file)
else:
logger.warning(
@@ -286,7 +286,7 @@ def checkQueryPntsFile(pnts_file, query_shape):
if os.path.exists(pnts_file):
# Check whether the number of points is consistent with the new inputs
with h5py.File(pnts_file, 'r') as f:
- if query_shape == f['lon'].attrs['Shape']:
+ if query_shape == tuple(f['lon'].attrs['Shape']):
write_flag = False
return write_flag
diff --git a/tools/RAiDER/delayFcns.py b/tools/RAiDER/delayFcns.py
index 3b4066b6a..c5fe78fa4 100755
--- a/tools/RAiDER/delayFcns.py
+++ b/tools/RAiDER/delayFcns.py
@@ -16,9 +16,10 @@
from pyproj import CRS, Transformer
from scipy.interpolate import RegularGridInterpolator
-from RAiDER.constants import _STEP
+from RAiDER.constants import _STEP, _ZREF, _RE
from RAiDER.interpolator import RegularGridInterpolator as Interpolator
from RAiDER.makePoints import makePoints1D
+from RAiDER.losreader import getZenithLookVecs
def calculate_rays(pnts_file, stepSize=_STEP):
@@ -26,50 +27,6 @@ def calculate_rays(pnts_file, stepSize=_STEP):
From a set of lats/lons/hgts, compute ray paths from the ground to the
top of the atmosphere, using either a set of look vectors or the zenith
'''
- # get the lengths of each ray for doing the interpolation
- getUnitLVs(pnts_file)
-
- # This projects the ground pixels into earth-centered, earth-fixed coordinate
- # system and sorts by position
- lla2ecef(pnts_file)
-
-
-def getUnitLVs(pnts_file):
- '''
- Get a set of look vectors normalized by their lengths
- '''
- get_lengths(pnts_file)
- with h5py.File(pnts_file, 'r+') as f:
- slv = f['LOS'][()] / f['Rays_len'][()][..., np.newaxis]
- f['Rays_SLV'][...] = slv
-
-
-def get_lengths(pnts_file):
- '''
- Returns the lengths of a vector or set of vectors, fast.
- Inputs:
- looks_vecs - an Nx3 numpy array containing look vectors with absolute
- lengths; i.e., the absolute position of the top of the
- atmosphere.
- Outputs:
- lengths - an Nx1 numpy array containing the absolute distance in
- meters of the top of the atmosphere from the ground pnt.
- '''
- with h5py.File(pnts_file, 'r+') as f:
- lengths = np.linalg.norm(f['LOS'][()], axis=-1)
- try:
- lengths[~np.isfinite(lengths)] = 0
- except TypeError:
- if ~np.isfinite(lengths):
- lengths = 0
- f['Rays_len'][:] = lengths.astype(np.float64)
- f['Rays_len'].attrs['MaxLen'] = np.nanmax(lengths)
-
-
-def lla2ecef(pnts_file):
- '''
- reproject a set of lat/lon/hgts to earth-centered, earth-fixed coordinate system
- '''
t = Transformer.from_crs(4326, 4978, always_xy=True) # converts from WGS84 geodetic to WGS84 geocentric
with h5py.File(pnts_file, 'r+') as f:
@@ -77,10 +34,14 @@ def lla2ecef(pnts_file):
lon = f['lon'][()]
lat = f['lat'][()]
hgt = f['hgt'][()]
- lon[lon == ndv] = np.nan
- lat[lat == ndv] = np.nan
- hgt[hgt == ndv] = np.nan
- sp = np.moveaxis(np.array(t.transform(lon, lat, hgt)), 0, -1)
+
+ lon[lon == ndv] = np.nan
+ lat[lat == ndv] = np.nan
+ hgt[hgt == ndv] = np.nan
+
+ sp = np.moveaxis(np.array(t.transform(lon, lat, hgt)), 0, -1)
+
+ with h5py.File(pnts_file, 'r+') as f:
f['Rays_SP'][...] = sp.astype(np.float64) # ensure double is maintained
@@ -115,7 +76,7 @@ def get_delays(
Nchunks = len(CHUNKS)
with h5py.File(pnts_file, 'r') as f:
- chunk_inputs = [(kk, CHUNKS[kk], np.array(f['Rays_SP']), np.array(f['Rays_SLV']),
+ chunk_inputs = [(kk, CHUNKS[kk], np.array(f['Rays_SP']), np.array(f['LOS']),
chunkSize, stepSize, ifWet, ifHydro, max_len, wm_file) for kk in range(Nchunks)]
if Nchunks == 1:
diff --git a/tools/RAiDER/gnss/processDelayFiles.py b/tools/RAiDER/gnss/processDelayFiles.py
index d07fd5cc1..2e5f43f21 100644
--- a/tools/RAiDER/gnss/processDelayFiles.py
+++ b/tools/RAiDER/gnss/processDelayFiles.py
@@ -1,3 +1,5 @@
+from textwrap import dedent
+import numpy as np
import argparse
import datetime
import glob
@@ -9,9 +11,6 @@
import pandas as pd
pd.options.mode.chained_assignment = None # default='warn'
-import numpy as np
-
-from textwrap import dedent
def combineDelayFiles(outName, loc=os.getcwd(), source='model', ext='.csv', ref=None, col_name='ZTD'):
@@ -92,9 +91,10 @@ def getDateTime(filename):
dtr = re.compile(r'\d{8}T\d{6}')
dt = dtr.search(filename)
return datetime.datetime.strptime(
- dt.group(),
- '%Y%m%dT%H%M%S'
- )
+ dt.group(),
+ '%Y%m%dT%H%M%S'
+ )
+
def update_time(row, localTime_hrs):
'''Update with local origin time'''
@@ -103,19 +103,21 @@ def update_time(row, localTime_hrs):
time_shift = datetime.timedelta(days=0)
# if lon <0, check if you need to add day
if row['Lon'] < 0:
- #round to nearest hour
+ # round to nearest hour
days_diff = (row['Datetime'] - \
- datetime.timedelta(seconds=math.floor(row['Localtime'])*3600)).day - \
- localTime_estimate.day
+ datetime.timedelta(seconds=math.floor(row['Localtime']) * 3600)).day - \
+ localTime_estimate.day
# add day
if days_diff != 0:
time_shift = datetime.timedelta(days=1)
- return localTime_estimate + datetime.timedelta(seconds=row['Localtime']*3600) + time_shift
+ return localTime_estimate + datetime.timedelta(seconds=row['Localtime'] * 3600) + time_shift
+
def pass_common_obs(reference, target):
'''Pass only observations in target spatiotemporally common to reference'''
return target[target['Datetime'].dt.date.isin(reference['Datetime'].dt.date) & target['ID'].isin(reference['ID'])]
+
def concatDelayFiles(
fileList,
sort_list=['ID', 'Datetime'],
@@ -153,8 +155,8 @@ def concatDelayFiles(
print('Total number of rows in the concatenated file: {}'.format(df_c.shape[0]))
print('Total number of rows containing NaNs: {}'.format(
- df_c[df_c.isna().any(axis=1)].shape[0]
- )
+ df_c[df_c.isna().any(axis=1)].shape[0]
+ )
)
if return_df or outName is None:
@@ -173,35 +175,35 @@ def local_time_filter(raiderFile, ztdFile, dfr, dfz, localTime):
'''
localTime_hrs = int(localTime.split(' ')[0])
localTime_hrthreshold = int(localTime.split(' ')[1])
- #with rotation rate and distance to 0 lon, get localtime shift WRT 00 UTC at 0 lon
- #*rotation rate at given point = (360deg/23.9333333333hr) = 15.041782729825965 deg/hr
+ # with rotation rate and distance to 0 lon, get localtime shift WRT 00 UTC at 0 lon
+ # *rotation rate at given point = (360deg/23.9333333333hr) = 15.041782729825965 deg/hr
dfr['Localtime'] = (dfr['Lon'] / 15.041782729825965)
dfz['Localtime'] = (dfz['Lon'] / 15.041782729825965)
- #estimate local-times
+ # estimate local-times
dfr['Localtime'] = dfr.apply(lambda r: update_time(r, localTime_hrs), axis=1)
dfz['Localtime'] = dfz.apply(lambda r: update_time(r, localTime_hrs), axis=1)
- #filter out data outside of --localtime hour threshold
+ # filter out data outside of --localtime hour threshold
dfr['Localtime_u'] = dfr['Localtime'] + datetime.timedelta(hours=localTime_hrthreshold)
dfr['Localtime_l'] = dfr['Localtime'] - datetime.timedelta(hours=localTime_hrthreshold)
OG_total = dfr.shape[0]
dfr = dfr[(dfr['Datetime'] >= dfr['Localtime_l']) & (dfr['Datetime'] <= dfr['Localtime_u'])]
print('Total number of datapoints dropped in {} for not being within {} hrs of specified local-time {}: {} out of {}'.format(
- raiderFile, localTime.split(' ')[1], localTime.split(' ')[0], dfr.shape[0], OG_total))
+ raiderFile, localTime.split(' ')[1], localTime.split(' ')[0], dfr.shape[0], OG_total))
dfz['Localtime_u'] = dfz['Localtime'] + datetime.timedelta(hours=localTime_hrthreshold)
dfz['Localtime_l'] = dfz['Localtime'] - datetime.timedelta(hours=localTime_hrthreshold)
OG_total = dfz.shape[0]
dfz = dfz[(dfz['Datetime'] >= dfz['Localtime_l']) & (dfz['Datetime'] <= dfz['Localtime_u'])]
print('Total number of datapoints dropped in {} for not being within {} hrs of specified local-time {}: {} out of {}'.format(
- ztdFile, localTime.split(' ')[1], localTime.split(' ')[0], dfz.shape[0], OG_total))
+ ztdFile, localTime.split(' ')[1], localTime.split(' ')[0], dfz.shape[0], OG_total))
# drop all lines with nans
dfr.dropna(how='any', inplace=True)
dfz.dropna(how='any', inplace=True)
# drop all duplicate lines
dfr.drop_duplicates(inplace=True)
dfz.drop_duplicates(inplace=True)
- #drop and rename columns
+ # drop and rename columns
dfr.drop(columns=['Localtime_l', 'Localtime_u', 'Datetime'], inplace=True)
dfr.rename(columns={'Localtime': 'Datetime'}, inplace=True)
dfz.drop(columns=['Localtime_l', 'Localtime_u', 'Datetime'], inplace=True)
@@ -211,13 +213,13 @@ def local_time_filter(raiderFile, ztdFile, dfr, dfz, localTime):
def mergeDelayFiles(
- raiderFile,
- ztdFile,
- col_name='ZTD',
- raider_delay='totalDelay',
- outName=None,
- localTime=None
- ):
+ raiderFile,
+ ztdFile,
+ col_name='ZTD',
+ raider_delay='totalDelay',
+ outName=None,
+ localTime=None
+):
'''
Merge a combined RAiDER delays file with a GPS ZTD delay file
'''
@@ -235,18 +237,18 @@ def mergeDelayFiles(
print('Beginning merge')
dfc = dfr.merge(
- dfz[['ID', 'Datetime', 'ZTD', 'sigZTD']],
- how='left',
- left_on=['Datetime', 'ID'],
- right_on=['Datetime', 'ID'],
- sort=True
- )
+ dfz[['ID', 'Datetime', 'ZTD', 'sigZTD']],
+ how='left',
+ left_on=['Datetime', 'ID'],
+ right_on=['Datetime', 'ID'],
+ sort=True
+ )
dfc['ZTD_minus_RAiDER'] = dfc['ZTD'] - dfc[raider_delay]
print('Total number of rows in the concatenated file: {}'.format(dfc.shape[0]))
print('Total number of rows containing NaNs: {}'.format(
- dfc[dfc.isna().any(axis=1)].shape[0]
- )
+ dfc[dfc.isna().any(axis=1)].shape[0]
+ )
)
print('Merge finished')
@@ -386,8 +388,8 @@ def parseCMD():
combineDelayFiles(args.raider_file, loc=args.raider_folder)
if ~os.path.exists(args.gnss_file):
- combineDelayFiles(args.gnss_file, loc=args.gnss_folder, source = 'GNSS',
- ref = args.raider_file, col_name=args.column_name)
+ combineDelayFiles(args.gnss_file, loc=args.gnss_folder, source='GNSS',
+ ref=args.raider_file, col_name=args.column_name)
if args.gnss_file is not None:
mergeDelayFiles(
diff --git a/tools/RAiDER/losreader.py b/tools/RAiDER/losreader.py
index 581eb1c1e..af2712008 100644
--- a/tools/RAiDER/losreader.py
+++ b/tools/RAiDER/losreader.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
-# Author: Jeremy Maurer, Raymond Hogenson & David Bekaert
+# Author: Jeremy Maurer, Brett Buzzanga, Raymond Hogenson & David Bekaert
# Copyright 2019, by the California Institute of Technology. ALL RIGHTS
# RESERVED. United States Government Sponsorship acknowledged.
#
@@ -10,128 +10,293 @@
import datetime
import os.path
import shelve
-import xml.etree.ElementTree as ET
+import xml.etree.ElementTree as ET
import numpy as np
+from scipy.interpolate import interp1d
+#from numba import jit
+
import RAiDER.utilFcns as utilFcns
+
from RAiDER import Geo2rdr
-from RAiDER.constants import _ZREF, Zenith
+from RAiDER.constants import _ZREF, Zenith, _RE
-# def state_to_los(t, x, y, z, vx, vy, vz, lats, lons, heights):
-# import Geo2rdr
-#
-# real_shape = lats.shape
-# lats = lats.flatten()
-# lons = lons.flatten()
-# heights = heights.flatten()
-#
-# geo2rdr_obj = Geo2rdr.PyGeo2rdr()
-# geo2rdr_obj.set_orbit(t, x, y, z, vx, vy, vz)
-#
-# loss = np.zeros((3, len(lats)))
-# slant_ranges = np.zeros_like(lats)
-#
-# for i, (lat, lon, height) in enumerate(zip(lats, lons, heights)):
-# height_array = np.array(((height,),))
-#
-# # Geo2rdr is picky about the type of height
-# height_array = height_array.astype(np.double)
-#
-# geo2rdr_obj.set_geo_coordinate(np.radians(lon),
-# np.radians(lat),
-# 1, 1,
-# height_array)
-# # compute the radar coordinate for each geo coordinate
-# geo2rdr_obj.geo2rdr()
-#
-# # get back the line of sight unit vector
-# los_x, los_y, los_z = geo2rdr_obj.get_los()
-# loss[:, i] = los_x, los_y, los_z
-#
-# # get back the slant ranges
-# slant_range = geo2rdr_obj.get_slant_range()
-# slant_ranges[i] = slant_range
-#
-# los = loss * slant_ranges
-#
-# # Have to think about traversal order here. It's easy, though, since
-# # in both orders xs come first, followed by all ys, followed by all
-# # zs.
-# return los.reshape((3,) + real_shape)
+
+_SLANT_RANGE_THRESH = 5e6
-def state_to_los(t, x, y, z, vx, vy, vz, lats, lons, heights, zref=_ZREF):
+def getLookVectors(los_type, lats, lons, heights, zref=_ZREF, time=None, pad=3 * 3600):
'''
- Converts information from a state vector for a satellite orbit, given in terms of
- position and velocity, to line-of-sight information at each (lon,lat, height)
- coordinate requested by the user.
+ Get unit look vectors pointing from the ground (target) pixels to the sensor,
+ or to Zenith. Can be accomplished using an ISCE-style 2-band LOS file or a
+ file containing orbital statevectors.
- *Note*:
- The LOS returned should be a vector pointing from the ground pixel to the sensor,
- truncating at the top of the troposphere, in an earth-centered, earth-fixed
- coordinate system.
+ *NOTE*:
+ These line-of-sight vectors will NOT match ordinary LOS vectors for InSAR
+ because they are in an ECEF reference frame instead of a local ENU. This is done
+ because the construction of rays is done in ECEF rather than the local ENU.
+
+ Parameters
+ ----------
+ los_type: LookVector object or tuple - Either a Zenith object or a tuple,
+ with the second element containing
+ the name of either a line-of-sight
+ file or orbital statevectors file
+ lats/lons/heights: ndarray - WGS-84 coordinates of the target pixels
+ time: python datetime - user-requested query time. Must be
+ compatible with the orbit file passed.
+ Only required for a statevector file.
+ pad: int - integer number of seconds to pad around
+ the user-specified time; default 3 hours
+ Only required for a statevector file.
+
+ Returns
+ -------
+ look_vecs: ndarray - an x 3 array of unit look vectors, defined in
+ an Earth-centered, earth-fixed reference frame (ECEF).
+ Convention is vectors point from the target pixel to the
+ sensor.
+ lengths: ndarray - array of of the distnce from the surface to
+ the top of the troposphere (denoted by zref)
+
+ Example:
+ --------
+ >>> from RAiDER.constants import Zenith
+ >>> from RAiDER.losreader import getLookVectors
+ >>> import numpy as np
+ >>> getLookVectors(Zenith, np.array([0]), np.array([0]), np.array([0]))
+ >>> # array([[1, 0, 0]])
'''
+ if (los_type is None) or (los_type is Zenith):
+ los_type = Zenith
+ else:
+ los_type = los_type[1]
- # check the inputs
- if t.size < 4:
- raise RuntimeError('state_to_los: At least 4 state vectors are required for orbit interpolation')
- if t.shape != x.shape:
- raise RuntimeError('state_to_los: t and x must be the same size')
- if lats.shape != lons.shape:
- raise RuntimeError('state_to_los: lats and lons must be the same size')
+ in_shape = lats.shape
- real_shape = lats.shape
- lats = lats.flatten()
- lons = lons.flatten()
- heights = heights.flatten()
+ if los_type is Zenith:
+ look_vecs = getZenithLookVecs(lats, lons, heights)
+ lengths = zref - heights
+ else:
+ try:
+ LOS_enu = inc_hd_to_enu(*utilFcns.gdal_open(los_type))
+ lengths = (zref - heights) / utilFcns.cosd(utilFcns.gdal_open(los_type)[0])
+ look_vecs = utilFcns.enu2ecef(
+ LOS_enu[..., 0],
+ LOS_enu[..., 1],
+ LOS_enu[..., 2],
+ lats,
+ lons,
+ heights
+ )
+
+ # if that doesn't work, try parsing as a statevector (orbit) file
+ except OSError:
+ svs = np.stack(get_sv(los_type, time, pad), axis=-1)
+ xyz_targets = np.stack(utilFcns.lla2ecef(lats, lons, heights), axis=-1)
+ look_vecs = state_to_los(
+ svs,
+ xyz_targets,
+ )
+ enu = utilFcns.ecef2enu(
+ look_vecs,
+ lats,
+ lons,
+ heights)
+ lengths = (zref - heights) / enu[..., 2]
+
+ # Otherwise, throw an error
+ except:
+ raise ValueError(
+ 'getLookVectors: I cannot parse the file {}'.format(look_vecs)
+ )
+
+ mask = (np.isnan(heights) | np.isnan(lats) | np.isnan(lons))
+ lengths[mask] = 0.
+ look_vecs[mask, :] = np.nan
- geo2rdr_obj = Geo2rdr.PyGeo2rdr()
- geo2rdr_obj.set_orbit(t, x, y, z, vx, vy, vz)
+ return look_vecs.astype(np.float64), lengths
- loss = np.zeros((3, len(lats)))
- slant_ranges = np.zeros_like(lats)
- for i, (lat, lon, height) in enumerate(zip(lats, lons, heights)):
- height_array = np.array(((height,),))
+def getZenithLookVecs(lats, lons, heights):
+ '''
+ Returns look vectors when Zenith is used.
- # Geo2rdr is picky about the type of height
- height_array = height_array.astype(np.double)
+ Parameters
+ ----------
+ lats/lons/heights: ndarray - Numpy arrays containing WGS-84 target locations
- lon_start, lat_start = np.radians(360 - lon), np.radians(lat)
- geo2rdr_obj.set_geo_coordinate(lon_start, lat_start, 1, 1, height_array)
+ Returns
+ -------
+ zenLookVecs: ndarray - (in_shape) x 3 unit look vectors in an ECEF reference frame
+ '''
+ x = np.cos(np.radians(lats)) * np.cos(np.radians(lons))
+ y = np.cos(np.radians(lats)) * np.sin(np.radians(lons))
+ z = np.sin(np.radians(lats))
+
+ return np.stack([x, y, z], axis=-1)
+
+
+def get_sv(los_file, ref_time, pad=3 * 3600):
+ """
+ Read an LOS file and return orbital state vectors
+
+ Parameters
+ ----------
+ los_file: str - user-passed file containing either look
+ vectors or statevectors for the sensor
+ ref_time: python datetime - User-requested datetime; if not encompassed
+ by the orbit times will raise a ValueError
+ pad: int - number of seconds to keep around the
+ requested time
+
+ Returns
+ -------
+ svs: 7 x 1 list of Nt x 1 ndarrays - the times, x/y/z positions and
+ velocities of the sensor for the given
+ window around the reference time
+ """
+ try:
+ svs = read_txt_file(los_file)
+ except ValueError:
+ try:
+ svs = read_ESA_Orbit_file(los_file, ref_time)
+ except:
+ try:
+ svs = read_shelve(los_file)
+ except:
+ raise ValueError(
+ 'get_sv: I cannot parse the statevector file {}'.format(los_file)
+ )
- # compute the radar coordinate for each geo coordinate
- geo2rdr_obj.geo2rdr()
+ idx = cut_times(svs[0], pad=pad)
+ svs = [d[idx] for d in svs]
+ return svs
- # get back the line of sight unit vector
- los_x, los_y, los_z = geo2rdr_obj.get_los()
- loss[:, i] = los_x, los_y, los_z
- # get back the slant ranges
- # slant_range = geo2rdr_obj.get_slant_range() #<- geo2rdr returns the slant range to sensor...not exactly what we want
- #slant_ranges[i] = slant_range
+def inc_hd_to_enu(incidence, heading):
+ '''
+ Convert incidence and heading to line-of-sight vectors from the ground to the top of
+ the troposphere.
- # We need LOS defined as pointing from the ground pixel to the sensor in ECEF reference frame
- #sp = np.stack(utilFcns.lla2ecef(lats, lons, heights),axis = -1)
- #pt_rng = np.linalg.norm(sp,axis=-1)
- #slant_ranges = slant_ranges - pt_rng
- los = -loss # * slant_ranges
+ Parameters
+ ----------
+ incidence: ndarray - incidence angle in deg from vertical
+ heading: ndarray - heading angle in deg clockwise from north
+ lats/lons/heights: ndarray - WGS84 ellipsoidal target (ground pixel) locations
- # Have to think about traversal order here. It's easy, though, since
- # in both orders xs come first, followed by all ys, followed by all
- # zs.
- return los.reshape(real_shape + (3,))
+ Returns
+ -------
+ LOS: ndarray - (input_shape) x 3 array of unit look vectors in local ENU
+ Algorithm referenced from http://earthdef.caltech.edu/boards/4/topics/327
+ '''
+ if np.any(incidence < 0):
+ raise ValueError('inc_hd_to_enu: Incidence angle cannot be less than 0')
-def read_shelve(filename):
+ east = utilFcns.sind(incidence) * utilFcns.cosd(heading + 90)
+ north = utilFcns.sind(incidence) * utilFcns.sind(heading + 90)
+ up = utilFcns.cosd(incidence)
+
+ return np.stack((east, north, up), axis=-1)
+
+
+# @jit(nopython=True)
+def state_to_los(svs, xyz_targets):
'''
- TODO: docstring
+ Converts information from a state vector for a satellite orbit, given in terms of
+ position and velocity, to line-of-sight information at each (lon,lat, height)
+ coordinate requested by the user.
+
+ Parameters
+ ----------
+ t, x, y, z, vx, vy, vz - time, position, and velocity in ECEF of the sensor
+ lats, lons, heights - Ellipsoidal (WGS84) positions of target ground pixels
+
+ Returns
+ -------
+ LOS - * x 3 matrix of LOS unit vectors in ECEF (*not* ENU)
+
+ Example:
+ >>> import datetime
+ >>> import numpy
+ >>> from RAiDER.utilFcns import gdal_open
+ >>> import RAiDER.losreader as losr
+ >>> lats, lons, heights = np.array([-76.1]), np.array([36.83]), np.array([0])
+ >>> time = datetime.datetime(2018,11,12,23,0,0)
+ >>> # download the orbit file beforehand
+ >>> esa_orbit_file = 'S1A_OPER_AUX_POEORB_OPOD_20181203T120749_V20181112T225942_20181114T005942.EOF'
+ >>> svs = losr.read_ESA_Orbit_file(esa_orbit_file, time)
+ >>> LOS = losr.state_to_los(*svs, lats=lats, lons=lons, heights=heights)
'''
+
+ # check the inputs
+ if np.min(svs.shape) < 4:
+ raise RuntimeError(
+ 'state_to_los: At least 4 state vectors are required'
+ ' for orbit interpolation'
+ )
+
+ # Flatten the input array for convenience
+ in_shape = xyz_targets.shape
+ target_xyz = np.stack([xyz_targets[..., 0].flatten(), xyz_targets[..., 1].flatten(), xyz_targets[..., 2].flatten()], axis=-1)
+ Npts = len(target_xyz)
+
+ # Iterate through targets and compute LOS
+ slant_range = []
+ los = np.empty((Npts, 3), dtype=np.float64)
+ breakpoint()
+ for k in range(Npts):
+ los[k, :], sr = get_radar_coordinate(target_xyz[k, :], svs)
+ slant_range.append(sr)
+ slant_ranges = np.array(slant_range)
+
+ # Sanity check for purpose of tracking problems
+ if slant_ranges.max() > _SLANT_RANGE_THRESH:
+ raise RuntimeError(
+ '''
+ state_to_los:
+ It appears that your input datetime and/or orbit file does not
+ correspond to the lats/lons that you've passed. Please verify
+ that the input datetime is the closest possible to the
+ acquisition times of the interferogram, and the orbit file covers
+ the same range of time.
+ '''
+ )
+
+ los_ecef = los.reshape(in_shape)
+ return los_ecef
+
+
+def cut_times(times, pad=3600 * 3):
+ """
+ Slice the orbit file around the reference aquisition time. This is done
+ by default using a three-hour window, which for Sentinel-1 empirically
+ works out to be roughly the largest window allowed by the orbit time.
+
+ Parameters
+ ----------
+ times: Nt x 1 ndarray - Vector of orbit times as seconds since the
+ user-requested time
+ pad: int - integer time in seconds to use as padding
+
+ Returns
+ -------
+ idx: Nt x 1 logical ndarray - a mask of times within the padded request time.
+ """
+ return np.abs(times) < pad
+
+
+def read_shelve(filename):
+ # TODO: docstring and unit tests
with shelve.open(filename, 'r') as db:
obj = db['frame']
numSV = len(obj.orbit.stateVectors)
+ breakpoint()
+ if numSV == 0:
+ raise ValueError('read_shelve: the file has not statevectors')
t = np.ones(numSV)
x = np.ones(numSV)
@@ -154,6 +319,22 @@ def read_shelve(filename):
def read_txt_file(filename):
+ '''
+ Read a 7-column text file containing orbit statevectors. Time
+ should be denoted as integer time in seconds since the reference
+ epoch (user-requested time).
+
+ Parameters
+ ----------
+ filename: str - user-supplied space-delimited text file with no header
+ containing orbital statevectors as 7 columns:
+ - time in seconds since the user-supplied epoch
+ - x / y / z locations in ECEF cartesian coordinates
+ - vx / vy / vz velocities in m/s in ECEF coordinates
+ Returns
+ svs: list - a length-7 list of numpy vectors containing the above
+ variables
+ '''
t = list()
x = list()
y = list()
@@ -177,12 +358,29 @@ def read_txt_file(filename):
vx.append(vx_)
vy.append(vy_)
vz.append(vz_)
+
+ if len(t) < 4:
+ raise ValueError('read_txt_file: File {} does not have enough statevectors'.format(filename))
+
return [np.array(a) for a in [t, x, y, z, vx, vy, vz]]
-def read_ESA_Orbit_file(filename, time=None):
+def read_ESA_Orbit_file(filename, ref_time):
'''
Read orbit data from an orbit file supplied by ESA
+
+ Parameters
+ ----------
+ filename: str - string of the orbit filename
+ ref_time: python datetime - user requested python datetime
+
+ Returns
+ -------
+ t: Nt x 1 ndarray - a numpy vector with Nt elements containing time
+ in seconds since the reference time, within "pad"
+ seconds of the reference time
+ x, y, z: Nt x 1 ndarrays - x/y/z positions of the sensor at the times t
+ vx, vy, vz: Nt x 1 ndarrays - x/y/z velocities of the sensor at the times t
'''
tree = ET.parse(filename)
root = tree.getroot()
@@ -197,8 +395,15 @@ def read_ESA_Orbit_file(filename, time=None):
vy = np.ones(numOSV)
vz = np.ones(numOSV)
+ times = []
for i, st in enumerate(data_block[0]):
- t[i] = (datetime.datetime.strptime(st[1].text, 'UTC=%Y-%m-%dT%H:%M:%S.%f') - datetime.datetime(1970, 1, 1)).total_seconds()
+ t[i] = (
+ datetime.datetime.strptime(
+ st[1].text,
+ 'UTC=%Y-%m-%dT%H:%M:%S.%f'
+ ) - ref_time
+ ).total_seconds()
+
x[i] = float(st[4].text)
y[i] = float(st[5].text)
z[i] = float(st[6].text)
@@ -206,140 +411,74 @@ def read_ESA_Orbit_file(filename, time=None):
vy[i] = float(st[8].text)
vz[i] = float(st[9].text)
- # Get the reference time
- if time is not None:
- time = (time - datetime.datetime(1970, 1, 1)).total_seconds()
- time = time - t[0]
-
- t = t - t[0]
-
- # if time is not None:
- # mask = np.abs(t - time) < 3600
- # t, x, y, z, vx, vy, vz = t[mask], x[mask], y[mask], z[mask], vx[mask], vy[mask], vz[mask]
-
return [t, x, y, z, vx, vy, vz]
-def infer_sv(los_file, lats, lons, heights, time=None):
- """Read an LOS file."""
- # TODO: Change this to a try/except structure
- _, ext = os.path.splitext(los_file)
- if ext == '.txt':
- svs = read_txt_file(los_file)
- elif ext == '.EOF':
- svs = read_ESA_Orbit_file(los_file, time)
- else:
- # Here's where things get complicated... Either it's a shelve
- # file or the user messed up. For now we'll just try to read it
- # as a shelve file, and throw whatever error that does, although
- # the message might be sometimes misleading.
- svs = read_shelve(los_file)
- LOSs = state_to_los(*svs, lats=lats, lons=lons, heights=heights)
- return LOSs
-
-
-def los_to_lv(incidence, heading, lats, lons, heights, zref, ranges=None):
- '''
- Convert incidence and heading to line-of-sight vectors from the ground to the top of
- the troposphere.
-
- *NOTE*:
- LOS here is defined in an Earth-centered, earth-referenced
- coordinate system as pointing from the ground pixel to the sensor, truncating at the top of
- the troposphere.
-
- Algorithm referenced from http://earthdef.caltech.edu/boards/4/topics/327
+# @jit(nopython=True)
+def get_radar_coordinate(xyz, svs, t0=None):
'''
- a_0 = incidence
- a_1 = heading
+ Calculate the coordinate of the sensor in ECEF at the time corresponding to ***.
- east = utilFcns.sind(a_0) * utilFcns.cosd(a_1 + 90)
- north = utilFcns.sind(a_0) * utilFcns.sind(a_1 + 90)
- up = utilFcns.cosd(a_0)
- east, north, up = np.stack((east, north, up))
+ Parameters
+ ----------
+ svs: ndarray - Nt x 7 matrix of statevectors: [t x y z vx vy vz]
+ xyz: ndarray - position of the target in ECEF
+ t0: double - starting point of the time at which the sensor imaged the target xyz
- # Pick reasonable range to top of troposphere if not provided
- if ranges is None:
- ranges = (zref - heights) / up
- #slant_range = ranges = (zref - heights) / utilFcns.cosd(inc)
-
- # Scale look vectors by range
- east, north, up = np.stack((east, north, up)) * ranges
-
- xyz = utilFcns.enu2ecef(
- east.flatten(), north.flatten(), up.flatten(), lats.flatten(),
- lons.flatten(), heights.flatten())
-
- sp_xyz = utilFcns.lla2ecef(lats.flatten(), lons.flatten(), heights.flatten())
- los = np.stack(xyz, axis=-1) - np.stack(sp_xyz, axis=-1)
- los = los.reshape(east.shape + (3,))
-
- return los
-
-
-def infer_los(los, lats, lons, heights, zref, time=None):
+ Returns
+ -------
+ sensor_xyz: ndarray - position of the sensor in ECEF
'''
- Helper function to deal with various LOS files supplied
- '''
-
- los_type, los_file = los
-
- if los_type == 'sv':
- LOS = infer_sv(los_file, lats, lons, heights, time)
- elif los_type == 'los':
- incidence, heading = [f.flatten() for f in utilFcns.gdal_open(los_file)]
- utilFcns.checkShapes(np.stack((incidence, heading), axis=-1), lats, lons, heights)
- LOS = los_to_lv(incidence, heading, lats, lons, heights, zref)
+ # initialize search
+ if t0 is None:
+ t = (svs[:, 0].max() - svs[:, 0].min()) / 2
else:
- raise ValueError("Unsupported los type '{}'".format(los_type))
- return LOS
-
-
-def _getZenithLookVecs(lats, lons, heights, zref=_ZREF):
+ t = t0
+
+ dt = 1.0
+ num_iteration = 20
+ residual_threshold = 0.000000001
+
+ dts = []
+ for k in range(num_iteration):
+ x = interpolate(svs[:, 0], svs[:, 1], t)
+ y = interpolate(svs[:, 0], svs[:, 2], t)
+ z = interpolate(svs[:, 0], svs[:, 3], t)
+ vx = interpolate(svs[:, 0], svs[:, 4], t)
+ vy = interpolate(svs[:, 0], svs[:, 5], t)
+ vz = interpolate(svs[:, 0], svs[:, 6], t)
+ E1 = vx * (xyz[0] - x) + vy * (xyz[1] - y) + vz * (xyz[2] - z)
+ dE1 = vx * vx + vy * vy + vz * vz
+ dt = E1 / dE1
+ dts.append(dt)
+ t = t + dt
+ if np.abs(dt) < residual_threshold:
+ break
+
+ los_x = xyz[0] - x
+ los_y = xyz[1] - y
+ los_z = xyz[2] - z
+
+ slant_range = np.sqrt(
+ np.square(los_x) + np.square(los_y) + np.square(los_z)
+ )
+ breakpoint()
+ return np.array([los_x, los_y, los_z]) / slant_range, slant_range
+
+
+def interpolate(t, var, tq):
'''
- Returns look vectors when Zenith is used.
- Inputs:
- lats/lons/heights - Nx1 numpy arrays of points.
- zref - float, integration height in meters
- Outputs:
- zenLookVecs - an Nx3 numpy array with the look vectors.
- The vectors give the zenith ray paths for
- each of the points to the top of the atmosphere.
- '''
- try:
- if (lats.ndim != 1) | (heights.ndim != 1) | (lons.ndim != 1):
- raise RuntimeError('_getZenithLookVecs: lats/lons/heights must be 1-D numpy arrays')
- except AttributeError:
- raise RuntimeError('_getZenithLookVecs: lats/lons/heights must be 1-D numpy arrays')
- if hasattr(zref, "__len__") | isinstance(zref, str):
- raise RuntimeError('_getZenithLookVecs: zref must be a scalar')
-
- e = np.cos(np.radians(lats)) * np.cos(np.radians(lons))
- n = np.cos(np.radians(lats)) * np.sin(np.radians(lons))
- u = np.sin(np.radians(lats))
- zenLookVecs = (np.array((e, n, u)).T * (zref - heights)[..., np.newaxis])
- return zenLookVecs.astype(np.float64)
+ Interpolate a set of statevectors to the requested input time
+ Parameters
+ ----------
+ statevectors: ndarray - an Nt x 7 matrix of statevectors: [t x y z vx vy vz]
+ tref: double - reference time requested (must be in the scope of t)
-def getLookVectors(look_vecs, lats, lons, heights, zref=_ZREF, time=None):
+ Returns
+ -------
+ x, y, z: double - sensor position in ECEF
+ vx, vy, vz: double - sensor velocity
'''
- If the input look vectors are specified as Zenith, compute and return the
- look vectors. Otherwise, check that the look_vecs shape makes sense.
- '''
- if look_vecs is None:
- look_vecs = Zenith
-
- in_shape = lats.shape
- lat = lats.flatten()
- lon = lons.flatten()
- hgt = heights.flatten()
-
- if look_vecs is Zenith:
- look_vecs = _getZenithLookVecs(lat, lon, hgt, zref=zref)
- else:
- look_vecs = infer_los(look_vecs, lat, lon, hgt, zref, time)
-
- mask = np.isnan(hgt) | np.isnan(lat) | np.isnan(lon)
- look_vecs[mask, :] = np.nan
-
- return look_vecs.reshape(in_shape + (3,)).astype(np.float64)
+ f = interp1d(t, var)
+ return f(tq)
diff --git a/tools/RAiDER/models/ecmwf.py b/tools/RAiDER/models/ecmwf.py
index cea33db35..1dac9c1e0 100755
--- a/tools/RAiDER/models/ecmwf.py
+++ b/tools/RAiDER/models/ecmwf.py
@@ -35,9 +35,8 @@ def __init__(self):
self._lat_res = 0.2
self._proj = CRS.from_epsg(4326)
- self._model_level_type = 'ml' # Default
+ self._model_level_type = 'ml' # Default
-
def setLevelType(self, levelType):
'''Set the level type to model levels or pressure levels'''
if levelType in ['ml', 'pl']:
@@ -50,7 +49,6 @@ def setLevelType(self, levelType):
else:
self.__pressure_levels__()
-
@abstractmethod
def __pressure_levels__(self):
pass
@@ -59,7 +57,7 @@ def __model_levels__(self):
self._levels = 137
self._zlevels = np.flipud(LEVELS_137_HEIGHTS)
self._a = A_137_HRES
- self._b = B_137_HRES
+ self._b = B_137_HRES
def load_weather(self, *args, **kwargs):
'''
@@ -195,14 +193,14 @@ def _get_from_ecmwf(self, lat_min, lat_max, lat_step, lon_min, lon_max,
})
def _get_from_cds(
- self,
- lat_min,
- lat_max,
- lat_step,
- lon_min,
+ self,
+ lat_min,
+ lat_max,
+ lat_step,
+ lon_min,
lon_max,
- lon_step,
- acqTime,
+ lon_step,
+ acqTime,
outname
):
import cdsapi
@@ -212,7 +210,7 @@ def _get_from_cds(
var = ['z', 'q', 't']
levType = 'pressure_level'
else:
- var = "129/130/133/152" #'lnsp', 'q', 'z', 't'
+ var = "129/130/133/152" # 'lnsp', 'q', 'z', 't'
levType = 'model_level'
bbox = [lat_max, lon_min, lat_min, lon_max]
@@ -242,7 +240,6 @@ def _get_from_cds(
logger.exception(e)
raise Exception
-
def _download_ecmwf(self, lat_min, lat_max, lat_step, lon_min, lon_max, lon_step, time, out):
from ecmwfapi import ECMWFService
@@ -276,7 +273,6 @@ def _download_ecmwf(self, lat_min, lat_max, lat_step, lon_min, lon_max, lon_step
out
)
-
def _load_pressure_level(self, filename, *args, **kwargs):
with xr.open_dataset(filename) as block:
# Pull the data
@@ -349,7 +345,6 @@ def _load_pressure_level(self, filename, *args, **kwargs):
self._t = np.flip(self._t, axis=2)
self._q = np.flip(self._q, axis=2)
-
def _makeDataCubes(self, fname, verbose=False):
'''
Create a cube of data representing temperature and relative humidity
@@ -382,5 +377,3 @@ def _makeDataCubes(self, fname, verbose=False):
'you may have a problem with your mask')
return lats, lons, xs, ys, t, q, lnsp, z
-
-
diff --git a/tools/RAiDER/models/era5.py b/tools/RAiDER/models/era5.py
index 1d9267a65..45facaf07 100755
--- a/tools/RAiDER/models/era5.py
+++ b/tools/RAiDER/models/era5.py
@@ -8,7 +8,6 @@
from RAiDER.models.model_levels import A_137_ERA5, B_137_ERA5, LEVELS_137_HEIGHTS, LEVELS_25_HEIGHTS
-
class ERA5(ECMWF):
# I took this from
# https://www.ecmwf.int/en/forecasts/documentation-and-support/137-model-levels.
@@ -27,7 +26,7 @@ def __init__(self):
# Availability lag time in days
self._lag_time = datetime.timedelta(days=30)
- # Default, need to change to ml
+ # Default, need to change to ml
self.setLevelType('pl')
def __pressure_levels__(self):
@@ -56,5 +55,6 @@ def load_weather(self, *args, **kwargs):
elif self._model_level_type == 'ml':
self._load_model_levels(*self.files, *args, **kwargs)
else:
- raise RuntimeError('{} is not a valid model type'.format(self._model_level_type))
-
+ raise RuntimeError(
+ '{} is not a valid model type'.format(self._model_level_type)
+ )
diff --git a/tools/RAiDER/models/hres.py b/tools/RAiDER/models/hres.py
index efda9808f..b8d73b9a6 100755
--- a/tools/RAiDER/models/hres.py
+++ b/tools/RAiDER/models/hres.py
@@ -34,10 +34,10 @@ def __init__(self, level_type='ml'):
self._k3 = 3.75e3 # [K^2/Pa]
# 9 km horizontal grid spacing. This is only used for extending the download-buffer, i.e. not in subsequent processing.
- self._lon_res = 9./111 #0.08108115
- self._lat_res = 9./111 #0.08108115
- self._x_res = 9./111 #0.08108115
- self._y_res = 9./111 #0.08108115
+ self._lon_res = 9. / 111 # 0.08108115
+ self._lat_res = 9. / 111 # 0.08108115
+ self._x_res = 9. / 111 # 0.08108115
+ self._y_res = 9. / 111 # 0.08108115
self._humidityType = 'q'
# Default, pressure levels are 'pl'
@@ -54,20 +54,18 @@ def __init__(self, level_type='ml'):
self.setLevelType('ml')
-
def __pressure_levels__(self):
self._levels = 25
self._zlevels = np.flipud(LEVELS_25_HEIGHTS)
def update_a_b(self):
- # Before 2013-06-26, there were only 91 model levels. The mapping coefficients below are extracted
+ # Before 2013-06-26, there were only 91 model levels. The mapping coefficients below are extracted
# based on https://www.ecmwf.int/en/forecasts/documentation-and-support/91-model-levels
self._levels = 91
self._zlevels = np.flipud(LEVELS_91_HEIGHTS)
self._a = A_91_HRES
self._b = B_91_HRES
-
def load_weather(self, filename=None):
'''
Consistent class method to be implemented across all weather model types.
@@ -84,7 +82,6 @@ def load_weather(self, filename=None):
self._load_model_levels(filename)
elif self._model_level_type == 'pl':
self._load_pressure_levels(filename)
-
def _fetch(self, lats, lons, time, out, Nextra=2):
'''
@@ -98,5 +95,3 @@ def _fetch(self, lats, lons, time, out, Nextra=2):
# execute the search at ECMWF
self._download_ecmwf(lat_min, lat_max, self._lat_res, lon_min, lon_max, self._lon_res, time, out)
-
-
diff --git a/tools/RAiDER/models/model_levels.py b/tools/RAiDER/models/model_levels.py
index 369d49c28..ba78f9f4a 100644
--- a/tools/RAiDER/models/model_levels.py
+++ b/tools/RAiDER/models/model_levels.py
@@ -505,5 +505,3 @@
-300,
-500,
]
-
-
diff --git a/tools/RAiDER/models/ncmr.py b/tools/RAiDER/models/ncmr.py
index 020054dbd..e82250491 100755
--- a/tools/RAiDER/models/ncmr.py
+++ b/tools/RAiDER/models/ncmr.py
@@ -13,9 +13,9 @@
from RAiDER.models.weatherModel import WeatherModel
from RAiDER.logger import logger
from RAiDER.utilFcns import (
- writeWeatherVars2NETCDF4,
- roundTime,
- read_NCMR_loginInfo,
+ writeWeatherVars2NETCDF4,
+ roundTime,
+ read_NCMR_loginInfo,
show_progress
)
@@ -90,27 +90,25 @@ def _download_ncmr_file(self, out, date_time, bounding_box):
Download weather model data (whole globe) from NCMR weblink, crop it to the region of interest, and save the cropped data as a standard .nc file of RAiDER (e.g. "NCMR_YYYY_MM_DD_THH_MM_SS.nc");
Temporarily download data from NCMR ftp 'https://ftp.ncmrwf.gov.in/pub/outgoing/SAC/NCUM_OSF/' and copied in weather_models folder
'''
-
+
from netCDF4 import Dataset
-
+
############# Use these lines and modify the link when actually downloading NCMR data from a weblink #############
- url, username, password = read_NCMR_loginInfo();
+ url, username, password = read_NCMR_loginInfo()
filename = os.path.basename(out)
url = f'ftp://{username}:{password}@{url}/TEST/{filename}'
filepath = f'{out[:-3]}_raw.nc'
if not os.path.exists(filepath):
logger.info('Fetching URL: %s', url)
- local_filename, headers = urllib.request.urlretrieve(url,filepath,show_progress)
+ local_filename, headers = urllib.request.urlretrieve(url, filepath, show_progress)
else:
logger.warning('Weather model already exists, skipping download')
########################################################################################################################
-
############# For debugging: use pre-downloaded files; Remove/comment out it when actually downloading NCMR data from a weblink #############
# filepath = os.path.dirname(out) + '/NCUM_ana_mdllev_20180701_00z.nc'
########################################################################################################################
-
# calculate the array indices for slicing the GMAO variable arrays
lat_min_ind = int((self._bounds[0] - (-89.94141)) / self._lat_res)
lat_max_ind = int((self._bounds[1] - (-89.94141)) / self._lat_res)
@@ -125,7 +123,7 @@ def _download_ncmr_file(self, out, date_time, bounding_box):
ml_min = 0
ml_max = 70
-
+
with Dataset(filepath, 'r', maskandscale=True) as f:
lats = f.variables['latitude'][lat_min_ind:(lat_max_ind + 1)].copy()
if (self._bounds[2] * self._bounds[3] < 0):
@@ -140,7 +138,7 @@ def _download_ncmr_file(self, out, date_time, bounding_box):
t = np.append(t1, t2, axis=2)
else:
t = f.variables['air_temperature'][ml_min:(ml_max + 1), lat_min_ind:(lat_max_ind + 1), lon_min_ind:(lon_max_ind + 1)].copy()
-
+
# Skipping first pressure levels (below 20 meter)
if (self._bounds[2] * self._bounds[3] < 0):
q1 = f.variables['specific_humidity'][(ml_min + 1):(ml_max + 1), lat_min_ind:(lat_max_ind + 1), lon_min_ind:].copy()
@@ -154,7 +152,7 @@ def _download_ncmr_file(self, out, date_time, bounding_box):
p = np.append(p1, p2, axis=2)
else:
p = f.variables['air_pressure'][(ml_min + 1):(ml_max + 1), lat_min_ind:(lat_max_ind + 1), lon_min_ind:(lon_max_ind + 1)].copy()
-
+
level_hgt = f.variables['level_height'][(ml_min + 1):(ml_max + 1)].copy()
if (self._bounds[2] * self._bounds[3] < 0):
surface_alt1 = f.variables['surface_altitude'][lat_min_ind:(lat_max_ind + 1), lon_min_ind:].copy()
@@ -162,14 +160,13 @@ def _download_ncmr_file(self, out, date_time, bounding_box):
surface_alt = np.append(surface_alt1, surface_alt2, axis=1)
else:
surface_alt = f.variables['surface_altitude'][lat_min_ind:(lat_max_ind + 1), lon_min_ind:(lon_max_ind + 1)].copy()
-
+
hgt = np.zeros([len(level_hgt), len(surface_alt[:, 1]), len(surface_alt[1, :])])
for i in range(len(level_hgt)):
hgt[i, :, :] = surface_alt[:, :] + level_hgt[i]
-
+
lons[lons > 180] -= 360
-
############# For debugging: comment it out when using pre-downloaded raw data files and don't want to remove them for test; Uncomment it when actually downloading NCMR data from a weblink #############
os.remove(filepath)
########################################################################################################################
@@ -179,13 +176,12 @@ def _download_ncmr_file(self, out, date_time, bounding_box):
except Exception:
logger.exception("Unable to save weathermodel to file")
-
def _makeDataCubes(self, filename):
'''
Get the variables from the saved .nc file (named as "NCMR_YYYY_MM_DD_THH_MM_SS.nc")
'''
from netCDF4 import Dataset
-
+
# adding the import here should become absolute when transition to netcdf
with Dataset(filename, mode='r') as f:
lons = np.array(f.variables['x'][:])
diff --git a/tools/RAiDER/models/weatherModel.py b/tools/RAiDER/models/weatherModel.py
index b422008a7..af9fa2b1c 100755
--- a/tools/RAiDER/models/weatherModel.py
+++ b/tools/RAiDER/models/weatherModel.py
@@ -54,7 +54,7 @@ def __init__(self):
# Define fixed constants
self._R_v = 461.524
- self._R_d = 287.06 # in our original code this was 287.053
+ self._R_d = 287.06 # in our original code this was 287.053
self._g0 = _g0 # gravity constant
self._zmin = _ZMIN # minimum integration height
self._zmax = _ZREF # max integration height
@@ -560,7 +560,7 @@ def _calculategeoh(self, z, lnsp):
Ph_lev = self._a[lev - 1] + (self._b[lev - 1] * sp)
Ph_levplusone = self._a[lev] + (self._b[lev] * sp)
- pressurelvs[ilevel] = (Ph_lev + Ph_levplusone)/2 # average pressure at half-levels above and below
+ pressurelvs[ilevel] = (Ph_lev + Ph_levplusone) / 2 # average pressure at half-levels above and below
if lev == 1:
dlogP = np.log(Ph_levplusone / 0.1)
@@ -583,7 +583,6 @@ def _calculategeoh(self, z, lnsp):
# integrate z_h to next half level
z_h += TRd * dlogP
-
return geopotential, pressurelvs, geoheight
def _get_ll_bounds(self, lats=None, lons=None, Nextra=2):
diff --git a/tools/RAiDER/processWM.py b/tools/RAiDER/processWM.py
index 2f8a90cce..359769c6b 100755
--- a/tools/RAiDER/processWM.py
+++ b/tools/RAiDER/processWM.py
@@ -42,7 +42,7 @@ def prepareWeatherModel(
if weather_model.files is None:
if time is None:
raise RuntimeError(
- 'prepareWeatherModel: Either a file or a time must be specified'
+ 'prepareWeatherModel: Either a file or a time must be specified'
)
weather_model.filename(time, wmLoc)
if os.path.exists(weather_model.files[0]):
diff --git a/tools/RAiDER/statsPlot.py b/tools/RAiDER/statsPlot.py
index e257ec0ae..0a7f107f9 100755
--- a/tools/RAiDER/statsPlot.py
+++ b/tools/RAiDER/statsPlot.py
@@ -81,7 +81,7 @@ def create_parser():
dtsubsets.add_argument('-si', '--seasonalinterval', dest='seasonalinterval', type=str, default=None,
help="Subset in by an specific interval for each year by specifying earliest MM-DD time followed by latest MM-DD time. -- Example : '03-21 06-21'.")
dtsubsets.add_argument('-oe', '--obs_errlimit', dest='obs_errlimit', type=float, default='inf',
- help="Observation error threshold to discard observations with large uncertainties.")
+ help="Observation error threshold to discard observations with large uncertainties.")
# Plot formatting/options
pltformat = parser.add_argument_group(
@@ -175,11 +175,11 @@ def convert_SI(val, unit_in, unit_out):
Convert input to desired units
'''
- SI = {'mm': 0.001, 'cm': 0.01, 'm': 1.0, 'km': 1000.,
+ SI = {'mm': 0.001, 'cm': 0.01, 'm': 1.0, 'km': 1000.,
'mm^2': 1e-6, 'cm^2': 1e-4, 'm^2': 1.0, 'km^2': 1e+6}
# avoid conversion if output unit in years
- if unit_in in ['days','years']:
+ if unit_in in ['days', 'years']:
return val
# check if output spatial unit is supported
@@ -526,7 +526,7 @@ def _append_variogram(self, grid_ind, grid_subset):
self.TOT_good_slices.append([grid_ind, tot_timetag])
self.TOT_res_robust_arr.append(TOT_res_robust.x)
self.TOT_tot_timetag.append(tot_timetag)
- var_rmse = np.sqrt(np.nanmean((TOT_res_robust.fun)**2))
+ var_rmse = np.sqrt(np.nanmean((TOT_res_robust.fun)**2))
if var_rmse <= self.variogram_errlimit:
self.TOT_res_robust_rmse.append(var_rmse)
else:
@@ -1302,10 +1302,10 @@ def _amplitude_and_phase(self, station, tt, yy, min_span=2, min_frac=0.6, period
# Fit with custom fit function with fixed period, if specified
if period_limit != 0:
# convert from years to radians/seconds
- w = (1/period_limit) * (1/31556952) * (2.*np.pi)
- custom_sine_function_base = lambda t, A, p, c: self._sine_function_base(t, A, w, p, c)
+ w = (1 / period_limit) * (1 / 31556952) * (2. * np.pi)
+ def custom_sine_function_base(t, A, p, c): return self._sine_function_base(t, A, w, p, c)
else:
- custom_sine_function_base = lambda t, A, w, p, c: self._sine_function_base(t, A, w, p, c)
+ def custom_sine_function_base(t, A, w, p, c): return self._sine_function_base(t, A, w, p, c)
# If station TS does not span specified time period, pass NaNs
time_span_yrs = (max(tt) - min(tt)) / 31556952
if time_span_yrs >= min_span and len(list(set(tt))) / (time_span_yrs * 365.25) >= min_frac:
@@ -1316,7 +1316,7 @@ def _amplitude_and_phase(self, station, tt, yy, min_span=2, min_frac=0.6, period
guess_freq = abs(ff[np.argmax(Fyy[1:]) + 1]) # excluding the zero period "peak", which is related to offset
guess_amp = np.std(yy) * 2.**0.5
guess_offset = np.mean(yy)
- guess = np.array([guess_amp, 2.*np.pi * guess_freq, 0., guess_offset])
+ guess = np.array([guess_amp, 2. * np.pi * guess_freq, 0., guess_offset])
# Adjust frequency guess to reflect fixed period, if specified
if period_limit != 0:
guess = np.array([guess_amp, 0., guess_offset])
@@ -1335,7 +1335,7 @@ def _amplitude_and_phase(self, station, tt, yy, min_span=2, min_frac=0.6, period
self.ampfit_c.append(np.nan), self.phsfit_c.append(np.nan), \
self.periodfit_c.append(np.nan), self.seasonalfit_rmse.append(np.nan)
return self.ampfit, self.phsfit, self.periodfit, self.ampfit_c, \
- self.phsfit_c, self.periodfit_c, self.seasonalfit_rmse
+ self.phsfit_c, self.periodfit_c, self.seasonalfit_rmse
except OptimizeWarning:
optimize_warning = True
warnings.simplefilter("ignore", OptimizeWarning)
@@ -1359,7 +1359,7 @@ def fitfunc(t): return A * np.sin(w * t + p) + c
# Convert phase from rad to days, apply half wavelength shift if Amp is negative
if A < 0:
p += 3.14159
- phsfit[station] = (365.25/2)*np.sin(p)
+ phsfit[station] = (365.25 / 2) * np.sin(p)
periodfit[station] = f
# Catch warning where output is so small that it gets rounded to 0
# I.e. RuntimeWarning: invalid value encountered in double_scalars
@@ -1370,9 +1370,9 @@ def fitfunc(t): return A * np.sin(w * t + p) + c
periodfit_c[station] = pcov[1, 1]**0.5
phsfit_c[station] = pcov[2, 2]**0.5
# pass RMSE of fit
- seasonalfit_rmse[station] = yy - custom_sine_function_base(tt,*popt)
- seasonalfit_rmse[station] = (scipy_sum(seasonalfit_rmse[station]**2)/ \
- (seasonalfit_rmse[station].size-2))**0.5
+ seasonalfit_rmse[station] = yy - custom_sine_function_base(tt, *popt)
+ seasonalfit_rmse[station] = (scipy_sum(seasonalfit_rmse[station]**2) / \
+ (seasonalfit_rmse[station].size - 2))**0.5
except FloatingPointError:
pass
if self.phaseamp_per_station or optimize_warning:
@@ -1410,7 +1410,7 @@ def fitfunc(t): return A * np.sin(w * t + p) + c
self.seasonalfit_rmse.append(seasonalfit_rmse)
return self.ampfit, self.phsfit, self.periodfit, self.ampfit_c, \
- self.phsfit_c, self.periodfit_c, self.seasonalfit_rmse
+ self.phsfit_c, self.periodfit_c, self.seasonalfit_rmse
def _sine_function_base(self, t, A, w, p, c):
'''
@@ -1605,9 +1605,9 @@ def __call__(self, gridarr, plottype, workdir='./', drawgridlines=False, colorba
axes.set_title(userTitle, zorder=2)
# save/close figure
- #cbar_ax.ax.locator_params(nbins=10)
- #for label in cbar_ax.ax.xaxis.get_ticklabels()[::25]:
- #label.set_visible(False)
+ # cbar_ax.ax.locator_params(nbins=10)
+ # for label in cbar_ax.ax.xaxis.get_ticklabels()[::25]:
+ # label.set_visible(False)
plt.savefig(os.path.join(workdir, self.col_name + '_' + plottype + '.' + plotFormat),
format=plotFormat, bbox_inches='tight')
plt.close()
@@ -1892,7 +1892,7 @@ def stats_analyses(
# write sill
gridfile_name = os.path.join(workdir, col_name + '_' + 'grid_variance' + '.tif')
save_gridfile(df_stats.grid_variance, 'grid_variance', gridfile_name, df_stats.plotbbox, df_stats.spacing, \
- df_stats.unit+'^2', colorbarfmt='%.3e', stationsongrids=df_stats.stationsongrids, gdal_fmt='float32')
+ df_stats.unit + '^2', colorbarfmt='%.3e', stationsongrids=df_stats.stationsongrids, gdal_fmt='float32')
# write variogram rmse
gridfile_name = os.path.join(workdir, col_name + '_' + 'grid_variogram_rmse' + '.tif')
save_gridfile(df_stats.grid_variogram_rmse, 'grid_variogram_rmse', gridfile_name, df_stats.plotbbox, df_stats.spacing, \
diff --git a/tools/RAiDER/utilFcns.py b/tools/RAiDER/utilFcns.py
index 15b828625..6923a747b 100755
--- a/tools/RAiDER/utilFcns.py
+++ b/tools/RAiDER/utilFcns.py
@@ -2,22 +2,25 @@
import multiprocessing as mp
import os
import re
+
from datetime import datetime, timedelta
import h5py
import numpy as np
+from numpy import ndarray
import pandas as pd
import pyproj
+from pyproj import CRS, Transformer
from osgeo import gdal, osr
import progressbar
from RAiDER.constants import (
- Zenith,
- _g0 as g0,
- _RE as Re,
- R_EARTH_MAX as Rmax,
- R_EARTH_MIN as Rmin,
- )
+ Zenith,
+ _g0 as g0,
+ _RE as Re,
+ R_EARTH_MAX as Rmax,
+ R_EARTH_MIN as Rmin,
+)
from RAiDER import Geo2rdr
from RAiDER.logger import *
@@ -28,6 +31,7 @@ def floorish(val, frac):
'''Round a value to the lower fractional part'''
return val - (val % frac)
+
def sind(x):
"""Return the sine of x when x is in degrees."""
return np.sin(np.radians(x))
@@ -39,27 +43,53 @@ def cosd(x):
def lla2ecef(lat, lon, height):
- ecef = pyproj.Proj(proj='geocent')
- lla = pyproj.Proj(proj='latlong')
-
- return pyproj.transform(lla, ecef, lon, lat, height, always_xy=True)
+ T = Transformer.from_crs(4326, 4978)
+ return T.transform(lon, lat, height)
-def enu2ecef(east, north, up, lat0, lon0, h0):
- """Return ecef from enu coordinates."""
- # I'm looking at
- # https://github.com/scivision/pymap3d/blob/master/pymap3d/__init__.py
- x0, y0, z0 = lla2ecef(lat0, lon0, h0)
+def enu2ecef(
+ east: ndarray,
+ north: ndarray,
+ up: ndarray,
+ lat0: ndarray,
+ lon0: ndarray,
+ h0: ndarray,
+):
+ """
+ Parameters
+ ----------
+ e1 : float
+ target east ENU coordinate (meters)
+ n1 : float
+ target north ENU coordinate (meters)
+ u1 : float
+ target up ENU coordinate (meters)
+ Results
+ -------
+ u : float
+ v : float
+ w : float
+ """
t = cosd(lat0) * up - sind(lat0) * north
w = sind(lat0) * up + cosd(lat0) * north
u = cosd(lon0) * t - sind(lon0) * east
v = sind(lon0) * t + cosd(lon0) * east
- my_ecef = np.stack((x0 + u, y0 + v, z0 + w))
+ return np.stack((u, v, w), axis=-1)
+
- return my_ecef
+def ecef2enu(xyz, lat, lon, height):
+ '''Convert ECEF xyz to ENU'''
+ x, y, z = xyz[..., 0], xyz[..., 1], xyz[..., 2]
+
+ t = cosd(lon) * x + sind(lon) * y
+
+ e = -sind(lon) * x + cosd(lon) * y
+ n = -sind(lat) * t + cosd(lat) * z
+ u = cosd(lat) * t + sind(lat) * z
+ return np.stack((e, n, u), axis=-1)
def gdal_extents(fname):
@@ -254,7 +284,7 @@ def _geo_to_ht(lats, hts):
# Calculate Geometric Height, h
h = (hts * Re) / (g_ll / g0 * Re - hts)
- # from metpy
+ # from metpy
# return (geopotential * Re) / (g0 * Re - geopotential)
return h
@@ -393,27 +423,24 @@ def getTimeFromFile(filename):
raise RuntimeError('The filename for {} does not include a datetime in the correct format'.format(filename))
-def writePnts2HDF5(lats, lons, hgts, los, outName='testx.h5', chunkSize=None, noDataValue=0.):
+def writePnts2HDF5(lats, lons, hgts, los, lengths, outName='testx.h5', chunkSize=None, noDataValue=0., epsg=4326):
'''
Write query points to an HDF5 file for storage and access
'''
- epsg = 4326
projname = 'projection'
+ # converts from WGS84 geodetic to WGS84 geocentric
+ t = Transformer.from_crs(epsg, 4978, always_xy=True)
+
checkLOS(los, np.prod(lats.shape))
in_shape = lats.shape
# create directory if needed
os.makedirs(os.path.abspath(os.path.dirname(outName)), exist_ok=True)
+ # Set up the chunking
if chunkSize is None:
- minChunkSize = 100
- maxChunkSize = 1000
- cpu_count = mp.cpu_count()
- chunkSize = tuple(max(min(maxChunkSize, s // cpu_count), min(s, minChunkSize)) for s in in_shape)
-
- logger.debug('Chunk size is {}'.format(chunkSize))
- logger.debug('Array shape is {}'.format(in_shape))
+ chunkSize = getChunkSize(in_shape)
with h5py.File(outName, 'w') as f:
f.attrs['Conventions'] = np.string_("CF-1.8")
@@ -421,10 +448,33 @@ def writePnts2HDF5(lats, lons, hgts, los, outName='testx.h5', chunkSize=None, no
x = f.create_dataset('lon', data=lons, chunks=chunkSize, fillvalue=noDataValue)
y = f.create_dataset('lat', data=lats, chunks=chunkSize, fillvalue=noDataValue)
z = f.create_dataset('hgt', data=hgts, chunks=chunkSize, fillvalue=noDataValue)
- los = f.create_dataset('LOS', data=los, chunks=chunkSize + (3,), fillvalue=noDataValue)
+ los = f.create_dataset(
+ 'LOS',
+ data=los,
+ chunks=chunkSize + (3,),
+ fillvalue=noDataValue
+ )
+ lengths = f.create_dataset(
+ 'Rays_len',
+ data=lengths,
+ chunks=x.chunks,
+ fillvalue=noDataValue
+ )
+ sp_data = np.stack(t.transform(lons, lats, hgts), axis=-1).astype(np.float64)
+ sp = f.create_dataset(
+ 'Rays_SP',
+ data=sp_data,
+ chunks=chunkSize + (3,),
+ fillvalue=noDataValue
+ )
+
x.attrs['Shape'] = in_shape
y.attrs['Shape'] = in_shape
z.attrs['Shape'] = in_shape
+ los.attrs['Shape'] = in_shape + (3,)
+ lengths.attrs['Shape'] = in_shape
+ lengths.attrs['Units'] = 'm'
+ sp.attrs['Shape'] = in_shape + (3,)
f.attrs['ChunkSize'] = chunkSize
f.attrs['NoDataValue'] = noDataValue
@@ -456,16 +506,12 @@ def writePnts2HDF5(lats, lons, hgts, los, outName='testx.h5', chunkSize=None, no
else:
raise NotImplemented
- start_positions = f.create_dataset('Rays_SP', in_shape + (3,), chunks=los.chunks, dtype=' residual_threshold)
{
- //std::cout << ii << std::endl;
st = orbit.get_statevector(t);
E1 = st.velocity.x*(xyz.x - st.position.x) + st.velocity.y*(xyz.y - st.position.y) + st.velocity.z*(xyz.z - st.position.z);
dE1 = -pow(st.velocity.x,2) - pow(st.velocity.y,2) - pow(st.velocity.z,2);
dt = -E1/dE1;
t = t+dt;
-
- //slant_range = sqrt(pow(xyz.x - st.position.x ,2) + pow(xyz.y - st.position.y, 2) + pow(xyz.z - st.position.z, 2));
-
- //std::cout << setprecision(10) << " ii, dt: " << ii << " , " << dt << " , " << slant_range << std::endl;
ii++;
}
- //std::cout << "azimuth time : " << t << std::endl;
sensor_xyz.x = st.position.x;
sensor_xyz.y = st.position.y;
sensor_xyz.z = st.position.z;
- //double t_azimuth = t;
slant_range = sqrt(pow(xyz.x - st.position.x ,2) + pow(xyz.y - st.position.y, 2) + pow(xyz.z - st.position.z, 2));
-
- //double t_isce = 3118.661048;
- //statevector st_i = orbit.get_statevector(t_isce);
- //double rng_isce = sqrt(pow(xyz.x - st_i.position.x ,2) + pow(xyz.y - st_i.position.y, 2) + pow(xyz.z - st_i.position.z, 2));
- //std::cout << setprecision(10) << "range with isce az time: " << rng_isce << std::endl;
}
void Geo2rdr::geo2rdr()
{
-
- std::cout << "geo2rdr" << std::endl;
-
ellipsoid elp;
- elp.wgs84();
+ elp.wgs84();
elp.info();
int middle_stvec = nr_state_vectors/2;
- double t0 = orbit.t[5]; // middle_stvec];
-
- //
- //statevector st = orbit.get_statevector(t0);
- //std::cout << " state vector at : " << t0 << std::endl;
- //std::cout << std::setprecision(10) << st.position.x << " , " << st.position.y << " , "<< st.position.z << std::endl;
-
- //
+ // double t0 = orbit.t[5]; // middle_stvec]; //orig
+ double t0 = orbit.t[middle_stvec]; //orig
double lat;
double lon;
@@ -194,21 +148,21 @@ void Geo2rdr::geo2rdr()
los_x = new double[nr_lines*nr_pixels];
los_y = new double[nr_lines*nr_pixels];
los_z = new double[nr_lines*nr_pixels];
+
+
for (int line=0; line < nr_lines; line++){
for (int pixel=0; pixel
#ifndef offsetof
@@ -654,6 +657,9 @@ static CYTHON_INLINE float __PYX_NAN() {
#include
#include
#include "numpy/arrayobject.h"
+#include "numpy/ndarrayobject.h"
+#include "numpy/ndarraytypes.h"
+#include "numpy/arrayscalars.h"
#include "numpy/ufuncobject.h"
/* NumPy API declarations from "numpy/__init__.pxd" */
@@ -936,7 +942,7 @@ typedef struct {
} __Pyx_BufFmt_Context;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":697
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":690
* # in Cython to enable them only on the right systems.
*
* ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
@@ -945,7 +951,7 @@ typedef struct {
*/
typedef npy_int8 __pyx_t_5numpy_int8_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":698
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":691
*
* ctypedef npy_int8 int8_t
* ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
@@ -954,7 +960,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t;
*/
typedef npy_int16 __pyx_t_5numpy_int16_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":699
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":692
* ctypedef npy_int8 int8_t
* ctypedef npy_int16 int16_t
* ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
@@ -963,7 +969,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t;
*/
typedef npy_int32 __pyx_t_5numpy_int32_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":700
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":693
* ctypedef npy_int16 int16_t
* ctypedef npy_int32 int32_t
* ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
@@ -972,7 +978,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t;
*/
typedef npy_int64 __pyx_t_5numpy_int64_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":704
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":697
* #ctypedef npy_int128 int128_t
*
* ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
@@ -981,7 +987,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t;
*/
typedef npy_uint8 __pyx_t_5numpy_uint8_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":705
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":698
*
* ctypedef npy_uint8 uint8_t
* ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
@@ -990,7 +996,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t;
*/
typedef npy_uint16 __pyx_t_5numpy_uint16_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":706
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":699
* ctypedef npy_uint8 uint8_t
* ctypedef npy_uint16 uint16_t
* ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
@@ -999,7 +1005,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t;
*/
typedef npy_uint32 __pyx_t_5numpy_uint32_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":707
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":700
* ctypedef npy_uint16 uint16_t
* ctypedef npy_uint32 uint32_t
* ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
@@ -1008,7 +1014,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t;
*/
typedef npy_uint64 __pyx_t_5numpy_uint64_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":711
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":704
* #ctypedef npy_uint128 uint128_t
*
* ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
@@ -1017,7 +1023,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t;
*/
typedef npy_float32 __pyx_t_5numpy_float32_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":712
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":705
*
* ctypedef npy_float32 float32_t
* ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
@@ -1026,7 +1032,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t;
*/
typedef npy_float64 __pyx_t_5numpy_float64_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":721
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":714
* # The int types are mapped a bit surprising --
* # numpy.int corresponds to 'l' and numpy.long to 'q'
* ctypedef npy_long int_t # <<<<<<<<<<<<<<
@@ -1035,7 +1041,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t;
*/
typedef npy_long __pyx_t_5numpy_int_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":722
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":715
* # numpy.int corresponds to 'l' and numpy.long to 'q'
* ctypedef npy_long int_t
* ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
@@ -1044,7 +1050,7 @@ typedef npy_long __pyx_t_5numpy_int_t;
*/
typedef npy_longlong __pyx_t_5numpy_long_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":723
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":716
* ctypedef npy_long int_t
* ctypedef npy_longlong long_t
* ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
@@ -1053,7 +1059,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t;
*/
typedef npy_longlong __pyx_t_5numpy_longlong_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":725
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":718
* ctypedef npy_longlong longlong_t
*
* ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
@@ -1062,7 +1068,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t;
*/
typedef npy_ulong __pyx_t_5numpy_uint_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":726
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":719
*
* ctypedef npy_ulong uint_t
* ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
@@ -1071,7 +1077,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t;
*/
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":727
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":720
* ctypedef npy_ulong uint_t
* ctypedef npy_ulonglong ulong_t
* ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
@@ -1080,7 +1086,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
*/
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":729
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":722
* ctypedef npy_ulonglong ulonglong_t
*
* ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
@@ -1089,7 +1095,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
*/
typedef npy_intp __pyx_t_5numpy_intp_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":730
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":723
*
* ctypedef npy_intp intp_t
* ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
@@ -1098,7 +1104,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t;
*/
typedef npy_uintp __pyx_t_5numpy_uintp_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":732
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":725
* ctypedef npy_uintp uintp_t
*
* ctypedef npy_double float_t # <<<<<<<<<<<<<<
@@ -1107,7 +1113,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t;
*/
typedef npy_double __pyx_t_5numpy_float_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":733
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":726
*
* ctypedef npy_double float_t
* ctypedef npy_double double_t # <<<<<<<<<<<<<<
@@ -1116,7 +1122,7 @@ typedef npy_double __pyx_t_5numpy_float_t;
*/
typedef npy_double __pyx_t_5numpy_double_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":734
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":727
* ctypedef npy_double float_t
* ctypedef npy_double double_t
* ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
@@ -1152,7 +1158,7 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do
/*--- Type declarations ---*/
struct __pyx_obj_6RAiDER_7Geo2rdr_PyGeo2rdr;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":736
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":729
* ctypedef npy_longdouble longdouble_t
*
* ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
@@ -1161,7 +1167,7 @@ struct __pyx_obj_6RAiDER_7Geo2rdr_PyGeo2rdr;
*/
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":737
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":730
*
* ctypedef npy_cfloat cfloat_t
* ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
@@ -1170,7 +1176,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
*/
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":738
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":731
* ctypedef npy_cfloat cfloat_t
* ctypedef npy_cdouble cdouble_t
* ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
@@ -1179,7 +1185,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
*/
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":740
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":733
* ctypedef npy_clongdouble clongdouble_t
*
* ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
@@ -1371,64 +1377,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg
/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
-/* DictGetItem.proto */
-#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
-static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
-#define __Pyx_PyObject_Dict_GetItem(obj, name)\
- (likely(PyDict_CheckExact(obj)) ?\
- __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
-#else
-#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
-#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
-#endif
-
-/* RaiseTooManyValuesToUnpack.proto */
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
-
-/* RaiseNeedMoreValuesToUnpack.proto */
-static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
-
-/* RaiseNoneIterError.proto */
-static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
-
-/* PyCFunctionFastCall.proto */
-#if CYTHON_FAST_PYCCALL
-static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
-#else
-#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
-#endif
-
-/* PyFunctionFastCall.proto */
-#if CYTHON_FAST_PYCALL
-#define __Pyx_PyFunction_FastCall(func, args, nargs)\
- __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
-#if 1 || PY_VERSION_HEX < 0x030600B1
-static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
-#else
-#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
-#endif
-#define __Pyx_BUILD_ASSERT_EXPR(cond)\
- (sizeof(char [1 - 2*!(cond)]) - 1)
-#ifndef Py_MEMBER_SIZE
-#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
-#endif
- static size_t __pyx_pyframe_localsplus_offset = 0;
- #include "frameobject.h"
- #define __Pxy_PyFrame_Initialize_Offsets()\
- ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
- (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
- #define __Pyx_PyFrame_GetLocalsplus(frame)\
- (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
-#endif
-
-/* PyObjectCallMethO.proto */
-#if CYTHON_COMPILING_IN_CPYTHON
-static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
-#endif
-
-/* PyObjectCallOneArg.proto */
-static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
-
/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
@@ -1710,14 +1658,10 @@ static void __Pyx_CppExn2PyErr() {
#endif
#endif
-/* CIntToPy.proto */
-static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
-
-/* CIntToPy.proto */
-static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
-
-/* CIntFromPy.proto */
-static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+/* GCCDiagnostics.proto */
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
+#define __Pyx_HAS_GCC_DIAGNOSTIC
+#endif
/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
@@ -1725,6 +1669,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
+/* CIntFromPy.proto */
+static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
+
/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
@@ -1773,8 +1720,17 @@ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
+static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
+static PyTypeObject *__pyx_ptype_5numpy_number = 0;
+static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
+static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
+static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
+static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
+static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
+static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
+static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
+static PyTypeObject *__pyx_ptype_5numpy_character = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
-static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/
/* Module declarations from 'Geo2rdr' */
@@ -1794,8 +1750,6 @@ int __pyx_module_is_main_RAiDER__Geo2rdr = 0;
/* Implementation of 'RAiDER.Geo2rdr' */
static PyObject *__pyx_builtin_TypeError;
-static PyObject *__pyx_builtin_RuntimeError;
-static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_ImportError;
static const char __pyx_k_x[] = "x";
static const char __pyx_k_y[] = "y";
@@ -1821,28 +1775,17 @@ static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_lat_first[] = "lat_first";
static const char __pyx_k_lon_first[] = "lon_first";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
-static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_ImportError[] = "ImportError";
-static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_Copyright_c_2018_Authors_s_Here[] = "\n\nCopyright (c) 2018-\nAuthors(s): Heresh Fattahi\n\n";
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
-static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
-static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
-static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
-static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
-static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
-static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
static PyObject *__pyx_n_s_ImportError;
-static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_n_s_PyGeo2rdr;
-static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_n_s_TypeError;
-static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_heights;
@@ -1865,7 +1808,6 @@ static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_times;
-static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_n_s_vx;
static PyObject *__pyx_n_s_vy;
static PyObject *__pyx_n_s_vz;
@@ -1886,9 +1828,6 @@ static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
-static PyObject *__pyx_tuple__5;
-static PyObject *__pyx_tuple__6;
-static PyObject *__pyx_tuple__7;
/* Late includes */
/* "tools/bindings/geometry/cython/Geo2rdr/Geo2rdr.pyx":24
@@ -3062,7 +3001,7 @@ static PyObject *__pyx_pf_6RAiDER_7Geo2rdr_9PyGeo2rdr_16__setstate_cython__(CYTH
return __pyx_r;
}
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":742
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":735
* ctypedef npy_cdouble complex_t
*
* cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
@@ -3079,7 +3018,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":743
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":736
*
* cdef inline object PyArray_MultiIterNew1(a):
* return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<<
@@ -3087,13 +3026,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__
* cdef inline object PyArray_MultiIterNew2(a, b):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 743, __pyx_L1_error)
+ __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 736, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":742
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":735
* ctypedef npy_cdouble complex_t
*
* cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
@@ -3112,7 +3051,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__
return __pyx_r;
}
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":745
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":738
* return PyArray_MultiIterNew(1, a)
*
* cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
@@ -3129,7 +3068,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":746
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":739
*
* cdef inline object PyArray_MultiIterNew2(a, b):
* return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<<
@@ -3137,13 +3076,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__
* cdef inline object PyArray_MultiIterNew3(a, b, c):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 746, __pyx_L1_error)
+ __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 739, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":745
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":738
* return PyArray_MultiIterNew(1, a)
*
* cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
@@ -3162,7 +3101,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__
return __pyx_r;
}
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":748
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":741
* return PyArray_MultiIterNew(2, a, b)
*
* cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
@@ -3179,7 +3118,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":749
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":742
*
* cdef inline object PyArray_MultiIterNew3(a, b, c):
* return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<<
@@ -3187,13 +3126,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 749, __pyx_L1_error)
+ __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 742, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":748
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":741
* return PyArray_MultiIterNew(2, a, b)
*
* cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
@@ -3212,7 +3151,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__
return __pyx_r;
}
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":751
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":744
* return PyArray_MultiIterNew(3, a, b, c)
*
* cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
@@ -3229,7 +3168,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":752
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":745
*
* cdef inline object PyArray_MultiIterNew4(a, b, c, d):
* return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<<
@@ -3237,13 +3176,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 752, __pyx_L1_error)
+ __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 745, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":751
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":744
* return PyArray_MultiIterNew(3, a, b, c)
*
* cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
@@ -3262,7 +3201,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__
return __pyx_r;
}
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":754
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":747
* return PyArray_MultiIterNew(4, a, b, c, d)
*
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
@@ -3279,7 +3218,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__
int __pyx_clineno = 0;
__Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":755
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":748
*
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
* return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<<
@@ -3287,13 +3226,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__
* cdef inline tuple PyDataType_SHAPE(dtype d):
*/
__Pyx_XDECREF(__pyx_r);
- __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 755, __pyx_L1_error)
+ __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 748, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":754
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":747
* return PyArray_MultiIterNew(4, a, b, c, d)
*
* cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
@@ -3312,7 +3251,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__
return __pyx_r;
}
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":757
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":750
* return PyArray_MultiIterNew(5, a, b, c, d, e)
*
* cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
@@ -3326,7 +3265,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__
int __pyx_t_1;
__Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":758
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":751
*
* cdef inline tuple PyDataType_SHAPE(dtype d):
* if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
@@ -3336,7 +3275,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__
__pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
if (__pyx_t_1) {
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":759
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":752
* cdef inline tuple PyDataType_SHAPE(dtype d):
* if PyDataType_HASSUBARRAY(d):
* return d.subarray.shape # <<<<<<<<<<<<<<
@@ -3348,7 +3287,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__
__pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
goto __pyx_L0;
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":758
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":751
*
* cdef inline tuple PyDataType_SHAPE(dtype d):
* if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
@@ -3357,12 +3296,12 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__
*/
}
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":761
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":754
* return d.subarray.shape
* else:
* return () # <<<<<<<<<<<<<<
*
- * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
+ *
*/
/*else*/ {
__Pyx_XDECREF(__pyx_r);
@@ -3371,7 +3310,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__
goto __pyx_L0;
}
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":757
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":750
* return PyArray_MultiIterNew(5, a, b, c, d, e)
*
* cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
@@ -3386,756 +3325,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__
return __pyx_r;
}
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":763
- * return ()
- *
- * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
- * # Recursive utility function used in __getbuffer__ to get format
- * # string. The new location in the format string is returned.
- */
-
-static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
- PyArray_Descr *__pyx_v_child = 0;
- int __pyx_v_endian_detector;
- int __pyx_v_little_endian;
- PyObject *__pyx_v_fields = 0;
- PyObject *__pyx_v_childname = NULL;
- PyObject *__pyx_v_new_offset = NULL;
- PyObject *__pyx_v_t = NULL;
- char *__pyx_r;
- __Pyx_RefNannyDeclarations
- PyObject *__pyx_t_1 = NULL;
- Py_ssize_t __pyx_t_2;
- PyObject *__pyx_t_3 = NULL;
- PyObject *__pyx_t_4 = NULL;
- int __pyx_t_5;
- int __pyx_t_6;
- int __pyx_t_7;
- long __pyx_t_8;
- char *__pyx_t_9;
- int __pyx_lineno = 0;
- const char *__pyx_filename = NULL;
- int __pyx_clineno = 0;
- __Pyx_RefNannySetupContext("_util_dtypestring", 0);
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":768
- *
- * cdef dtype child
- * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
- * cdef bint little_endian = ((&endian_detector)[0] != 0)
- * cdef tuple fields
- */
- __pyx_v_endian_detector = 1;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":769
- * cdef dtype child
- * cdef int endian_detector = 1
- * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
- * cdef tuple fields
- *
- */
- __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":772
- * cdef tuple fields
- *
- * for childname in descr.names: # <<<<<<<<<<<<<<
- * fields = descr.fields[childname]
- * child, new_offset = fields
- */
- if (unlikely(__pyx_v_descr->names == Py_None)) {
- PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
- __PYX_ERR(2, 772, __pyx_L1_error)
- }
- __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
- for (;;) {
- if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
- #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(2, 772, __pyx_L1_error)
- #else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 772, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- #endif
- __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
- __pyx_t_3 = 0;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":773
- *
- * for childname in descr.names:
- * fields = descr.fields[childname] # <<<<<<<<<<<<<<
- * child, new_offset = fields
- *
- */
- if (unlikely(__pyx_v_descr->fields == Py_None)) {
- PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
- __PYX_ERR(2, 773, __pyx_L1_error)
- }
- __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 773, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(2, 773, __pyx_L1_error)
- __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
- __pyx_t_3 = 0;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":774
- * for childname in descr.names:
- * fields = descr.fields[childname]
- * child, new_offset = fields # <<<<<<<<<<<<<<
- *
- * if (end - f) - (new_offset - offset[0]) < 15:
- */
- if (likely(__pyx_v_fields != Py_None)) {
- PyObject* sequence = __pyx_v_fields;
- Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
- if (unlikely(size != 2)) {
- if (size > 2) __Pyx_RaiseTooManyValuesError(2);
- else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- __PYX_ERR(2, 774, __pyx_L1_error)
- }
- #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
- __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
- __Pyx_INCREF(__pyx_t_3);
- __Pyx_INCREF(__pyx_t_4);
- #else
- __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 774, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 774, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- #endif
- } else {
- __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 774, __pyx_L1_error)
- }
- if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(2, 774, __pyx_L1_error)
- __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
- __pyx_t_3 = 0;
- __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
- __pyx_t_4 = 0;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":776
- * child, new_offset = fields
- *
- * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
- * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
- *
- */
- __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 776, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 776, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 776, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
- if (unlikely(__pyx_t_6)) {
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":777
- *
- * if (end - f) - (new_offset - offset[0]) < 15:
- * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
- *
- * if ((child.byteorder == c'>' and little_endian) or
- */
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 777, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(2, 777, __pyx_L1_error)
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":776
- * child, new_offset = fields
- *
- * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
- * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
- *
- */
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":779
- * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
- *
- * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
- * (child.byteorder == c'<' and not little_endian)):
- * raise ValueError(u"Non-native byte order not supported")
- */
- __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
- if (!__pyx_t_7) {
- goto __pyx_L8_next_or;
- } else {
- }
- __pyx_t_7 = (__pyx_v_little_endian != 0);
- if (!__pyx_t_7) {
- } else {
- __pyx_t_6 = __pyx_t_7;
- goto __pyx_L7_bool_binop_done;
- }
- __pyx_L8_next_or:;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":780
- *
- * if ((child.byteorder == c'>' and little_endian) or
- * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
- * raise ValueError(u"Non-native byte order not supported")
- * # One could encode it in the format string and have Cython
- */
- __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
- if (__pyx_t_7) {
- } else {
- __pyx_t_6 = __pyx_t_7;
- goto __pyx_L7_bool_binop_done;
- }
- __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
- __pyx_t_6 = __pyx_t_7;
- __pyx_L7_bool_binop_done:;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":779
- * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
- *
- * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
- * (child.byteorder == c'<' and not little_endian)):
- * raise ValueError(u"Non-native byte order not supported")
- */
- if (unlikely(__pyx_t_6)) {
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":781
- * if ((child.byteorder == c'>' and little_endian) or
- * (child.byteorder == c'<' and not little_endian)):
- * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
- * # One could encode it in the format string and have Cython
- * # complain instead, BUT: < and > in format strings also imply
- */
- __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 781, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __Pyx_Raise(__pyx_t_3, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __PYX_ERR(2, 781, __pyx_L1_error)
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":779
- * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
- *
- * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
- * (child.byteorder == c'<' and not little_endian)):
- * raise ValueError(u"Non-native byte order not supported")
- */
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":791
- *
- * # Output padding bytes
- * while offset[0] < new_offset: # <<<<<<<<<<<<<<
- * f[0] = 120 # "x"; pad byte
- * f += 1
- */
- while (1) {
- __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 791, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 791, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 791, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (!__pyx_t_6) break;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":792
- * # Output padding bytes
- * while offset[0] < new_offset:
- * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
- * f += 1
- * offset[0] += 1
- */
- (__pyx_v_f[0]) = 0x78;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":793
- * while offset[0] < new_offset:
- * f[0] = 120 # "x"; pad byte
- * f += 1 # <<<<<<<<<<<<<<
- * offset[0] += 1
- *
- */
- __pyx_v_f = (__pyx_v_f + 1);
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":794
- * f[0] = 120 # "x"; pad byte
- * f += 1
- * offset[0] += 1 # <<<<<<<<<<<<<<
- *
- * offset[0] += child.itemsize
- */
- __pyx_t_8 = 0;
- (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":796
- * offset[0] += 1
- *
- * offset[0] += child.itemsize # <<<<<<<<<<<<<<
- *
- * if not PyDataType_HASFIELDS(child):
- */
- __pyx_t_8 = 0;
- (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":798
- * offset[0] += child.itemsize
- *
- * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
- * t = child.type_num
- * if end - f < 5:
- */
- __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
- if (__pyx_t_6) {
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":799
- *
- * if not PyDataType_HASFIELDS(child):
- * t = child.type_num # <<<<<<<<<<<<<<
- * if end - f < 5:
- * raise RuntimeError(u"Format string allocated too short.")
- */
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 799, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
- __pyx_t_4 = 0;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":800
- * if not PyDataType_HASFIELDS(child):
- * t = child.type_num
- * if end - f < 5: # <<<<<<<<<<<<<<
- * raise RuntimeError(u"Format string allocated too short.")
- *
- */
- __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
- if (unlikely(__pyx_t_6)) {
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":801
- * t = child.type_num
- * if end - f < 5:
- * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
- *
- * # Until ticket #99 is fixed, use integers to avoid warnings
- */
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 801, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_Raise(__pyx_t_4, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __PYX_ERR(2, 801, __pyx_L1_error)
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":800
- * if not PyDataType_HASFIELDS(child):
- * t = child.type_num
- * if end - f < 5: # <<<<<<<<<<<<<<
- * raise RuntimeError(u"Format string allocated too short.")
- *
- */
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":804
- *
- * # Until ticket #99 is fixed, use integers to avoid warnings
- * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
- * elif t == NPY_UBYTE: f[0] = 66 #"B"
- * elif t == NPY_SHORT: f[0] = 104 #"h"
- */
- __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 804, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 804, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 804, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 98;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":805
- * # Until ticket #99 is fixed, use integers to avoid warnings
- * if t == NPY_BYTE: f[0] = 98 #"b"
- * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
- * elif t == NPY_SHORT: f[0] = 104 #"h"
- * elif t == NPY_USHORT: f[0] = 72 #"H"
- */
- __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 805, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 805, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 805, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 66;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":806
- * if t == NPY_BYTE: f[0] = 98 #"b"
- * elif t == NPY_UBYTE: f[0] = 66 #"B"
- * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
- * elif t == NPY_USHORT: f[0] = 72 #"H"
- * elif t == NPY_INT: f[0] = 105 #"i"
- */
- __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 806, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 806, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 806, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 0x68;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":807
- * elif t == NPY_UBYTE: f[0] = 66 #"B"
- * elif t == NPY_SHORT: f[0] = 104 #"h"
- * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
- * elif t == NPY_INT: f[0] = 105 #"i"
- * elif t == NPY_UINT: f[0] = 73 #"I"
- */
- __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 807, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 807, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 807, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 72;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":808
- * elif t == NPY_SHORT: f[0] = 104 #"h"
- * elif t == NPY_USHORT: f[0] = 72 #"H"
- * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
- * elif t == NPY_UINT: f[0] = 73 #"I"
- * elif t == NPY_LONG: f[0] = 108 #"l"
- */
- __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 808, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 808, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 808, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 0x69;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":809
- * elif t == NPY_USHORT: f[0] = 72 #"H"
- * elif t == NPY_INT: f[0] = 105 #"i"
- * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
- * elif t == NPY_LONG: f[0] = 108 #"l"
- * elif t == NPY_ULONG: f[0] = 76 #"L"
- */
- __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 809, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 809, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 809, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 73;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":810
- * elif t == NPY_INT: f[0] = 105 #"i"
- * elif t == NPY_UINT: f[0] = 73 #"I"
- * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
- * elif t == NPY_ULONG: f[0] = 76 #"L"
- * elif t == NPY_LONGLONG: f[0] = 113 #"q"
- */
- __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 810, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 810, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 810, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 0x6C;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":811
- * elif t == NPY_UINT: f[0] = 73 #"I"
- * elif t == NPY_LONG: f[0] = 108 #"l"
- * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
- * elif t == NPY_LONGLONG: f[0] = 113 #"q"
- * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
- */
- __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 811, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 811, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 811, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 76;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":812
- * elif t == NPY_LONG: f[0] = 108 #"l"
- * elif t == NPY_ULONG: f[0] = 76 #"L"
- * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
- * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
- * elif t == NPY_FLOAT: f[0] = 102 #"f"
- */
- __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 812, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 812, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 812, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 0x71;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":813
- * elif t == NPY_ULONG: f[0] = 76 #"L"
- * elif t == NPY_LONGLONG: f[0] = 113 #"q"
- * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
- * elif t == NPY_FLOAT: f[0] = 102 #"f"
- * elif t == NPY_DOUBLE: f[0] = 100 #"d"
- */
- __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 813, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 813, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 813, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 81;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":814
- * elif t == NPY_LONGLONG: f[0] = 113 #"q"
- * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
- * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
- * elif t == NPY_DOUBLE: f[0] = 100 #"d"
- * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
- */
- __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 814, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 814, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 814, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 0x66;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":815
- * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
- * elif t == NPY_FLOAT: f[0] = 102 #"f"
- * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
- * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
- * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
- */
- __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 815, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 815, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 815, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 0x64;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":816
- * elif t == NPY_FLOAT: f[0] = 102 #"f"
- * elif t == NPY_DOUBLE: f[0] = 100 #"d"
- * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
- * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
- * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
- */
- __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 816, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 816, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 816, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 0x67;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":817
- * elif t == NPY_DOUBLE: f[0] = 100 #"d"
- * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
- * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
- * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
- * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
- */
- __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 817, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 817, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 817, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 90;
- (__pyx_v_f[1]) = 0x66;
- __pyx_v_f = (__pyx_v_f + 1);
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":818
- * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
- * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
- * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
- * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
- * elif t == NPY_OBJECT: f[0] = 79 #"O"
- */
- __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 818, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 818, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 818, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 90;
- (__pyx_v_f[1]) = 0x64;
- __pyx_v_f = (__pyx_v_f + 1);
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":819
- * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
- * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
- * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
- * elif t == NPY_OBJECT: f[0] = 79 #"O"
- * else:
- */
- __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 819, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 819, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 819, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- if (__pyx_t_6) {
- (__pyx_v_f[0]) = 90;
- (__pyx_v_f[1]) = 0x67;
- __pyx_v_f = (__pyx_v_f + 1);
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":820
- * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
- * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
- * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
- * else:
- * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
- */
- __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 820, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 820, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(2, 820, __pyx_L1_error)
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (likely(__pyx_t_6)) {
- (__pyx_v_f[0]) = 79;
- goto __pyx_L15;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":822
- * elif t == NPY_OBJECT: f[0] = 79 #"O"
- * else:
- * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
- * f += 1
- * else:
- */
- /*else*/ {
- __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 822, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 822, __pyx_L1_error)
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_Raise(__pyx_t_4, 0, 0, 0);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __PYX_ERR(2, 822, __pyx_L1_error)
- }
- __pyx_L15:;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":823
- * else:
- * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
- * f += 1 # <<<<<<<<<<<<<<
- * else:
- * # Cython ignores struct boundary information ("T{...}"),
- */
- __pyx_v_f = (__pyx_v_f + 1);
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":798
- * offset[0] += child.itemsize
- *
- * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
- * t = child.type_num
- * if end - f < 5:
- */
- goto __pyx_L13;
- }
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":827
- * # Cython ignores struct boundary information ("T{...}"),
- * # so don't output it
- * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
- * return f
- *
- */
- /*else*/ {
- __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(2, 827, __pyx_L1_error)
- __pyx_v_f = __pyx_t_9;
- }
- __pyx_L13:;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":772
- * cdef tuple fields
- *
- * for childname in descr.names: # <<<<<<<<<<<<<<
- * fields = descr.fields[childname]
- * child, new_offset = fields
- */
- }
- __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":828
- * # so don't output it
- * f = _util_dtypestring(child, f, end, offset)
- * return f # <<<<<<<<<<<<<<
- *
- *
- */
- __pyx_r = __pyx_v_f;
- goto __pyx_L0;
-
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":763
- * return ()
- *
- * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
- * # Recursive utility function used in __getbuffer__ to get format
- * # string. The new location in the format string is returned.
- */
-
- /* function exit code */
- __pyx_L1_error:;
- __Pyx_XDECREF(__pyx_t_1);
- __Pyx_XDECREF(__pyx_t_3);
- __Pyx_XDECREF(__pyx_t_4);
- __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
- __pyx_r = NULL;
- __pyx_L0:;
- __Pyx_XDECREF((PyObject *)__pyx_v_child);
- __Pyx_XDECREF(__pyx_v_fields);
- __Pyx_XDECREF(__pyx_v_childname);
- __Pyx_XDECREF(__pyx_v_new_offset);
- __Pyx_XDECREF(__pyx_v_t);
- __Pyx_RefNannyFinishContext();
- return __pyx_r;
-}
-
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":943
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":931
* int _import_umath() except -1
*
* cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
@@ -4147,7 +3337,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("set_array_base", 0);
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":944
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":932
*
* cdef inline void set_array_base(ndarray arr, object base):
* Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
@@ -4156,7 +3346,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
*/
Py_INCREF(__pyx_v_base);
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":945
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":933
* cdef inline void set_array_base(ndarray arr, object base):
* Py_INCREF(base) # important to do this before stealing the reference below!
* PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
@@ -4165,7 +3355,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
*/
(void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":943
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":931
* int _import_umath() except -1
*
* cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
@@ -4177,7 +3367,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a
__Pyx_RefNannyFinishContext();
}
-/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":947
+/* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":935
* PyArray_SetBaseObject(arr, base)
*
* cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
@@ -4192,7 +3382,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
int __pyx_t_1;
__Pyx_RefNannySetupContext("get_array_base", 0);
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":948
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":936
*
* cdef inline object get_array_base(ndarray arr):
* base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
@@ -4201,7 +3391,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
*/
__pyx_v_base = PyArray_BASE(__pyx_v_arr);
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":949
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":937
* cdef inline object get_array_base(ndarray arr):
* base = PyArray_BASE(arr)
* if base is NULL: # <<<<<<<<<<<<<<
@@ -4211,7 +3401,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
__pyx_t_1 = ((__pyx_v_base == NULL) != 0);
if (__pyx_t_1) {
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":950
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":938
* base = PyArray_BASE(arr)
* if base is NULL:
* return None # <<<<<<<<<<<<<<
@@ -4222,7 +3412,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
__pyx_r = Py_None; __Pyx_INCREF(Py_None);
goto __pyx_L0;
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":949
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":937
* cdef inline object get_array_base(ndarray arr):
* base = PyArray_BASE(arr)
* if base is NULL: # <<<<<<<<<<<<<<
@@ -4231,7 +3421,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py
*/
}
- /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":951
+ /* "../../Miniconda3/envs/RAiDER/lib/python3.7/site-packages/numpy/__init__.pxd":939
* if base is NULL:
* return None
* return