Pull in changes from dataplumber/nexus time-series-tiles
Project: http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/commit/9b74bc66 Tree: http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/tree/9b74bc66 Diff: http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/diff/9b74bc66 Branch: refs/heads/master Commit: 9b74bc66fce573e9c2c5cbe7748afb3ff92aa16c Parents: ecf6a60 Author: fgreg <[email protected]> Authored: Wed Jan 10 17:14:11 2018 -0800 Committer: Frank Greguska <[email protected]> Committed: Wed Jan 10 17:15:21 2018 -0800 ---------------------------------------------------------------------- data-access/nexustiles/dao/CassandraProxy.pyx | 22 +++++++- data-access/requirements.txt | 2 +- data-access/setup.py | 2 +- .../add-day-of-year-attribute.groovy | 2 +- .../add-time-from-granulename.groovy | 2 +- .../groovy-scripts/generate-tile-id.groovy | 2 +- .../groovy-scripts/nexustile-to-string.groovy | 2 +- .../groovy-scripts/set-dataset-name.groovy | 2 +- nexus-ingest/nexus-messages/build.gradle | 2 +- .../src/main/proto/NexusContent.proto | 14 +++++ .../src/main/python/nexusproto/setup.py | 2 +- nexus-ingest/nexus-sink/build.gradle | 2 +- .../nexusxd/tilereadingprocessor.py | 50 ++++++++++++++++- .../nexus-xd-python-modules/requirements.txt | 2 +- .../tests/datafiles/not_empty_wswm.nc | Bin 0 -> 33119 bytes .../tests/hd5splitter.py | 29 +++++----- .../tests/tilereadingprocessor_test.py | 55 +++++++++++++++++++ 17 files changed, 164 insertions(+), 28 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/data-access/nexustiles/dao/CassandraProxy.pyx ---------------------------------------------------------------------- diff --git a/data-access/nexustiles/dao/CassandraProxy.pyx b/data-access/nexustiles/dao/CassandraProxy.pyx index c9008b2..4662412 100644 --- a/data-access/nexustiles/dao/CassandraProxy.pyx +++ b/data-access/nexustiles/dao/CassandraProxy.pyx @@ -84,8 +84,28 @@ class NexusTileData(Model): meta_data[name] = reshaped_meta_array return latitude_data, longitude_data, time_data, tile_data, meta_data + elif self._get_nexus_tile().HasField('time_series_tile'): + time_series_tile = self._get_nexus_tile().time_series_tile + + time_series_tile_data = np.ma.masked_invalid(from_shaped_array(time_series_tile.variable_data)) + time_data = np.array([time_series_tile.time]) + latitude_data = np.ma.masked_invalid(from_shaped_array(time_series_tile.latitude)) + longitude_data = np.ma.masked_invalid(from_shaped_array(time_series_tile.longitude)) + + tile_data = self._to_standard_index(time_series_tile_data, + (len(time_data), len(latitude_data), len(longitude_data))) + + # Extract the meta data + meta_data = {} + for meta_data_obj in time_series_tile.meta_data: + name = meta_data_obj.name + meta_array = np.ma.masked_invalid(from_shaped_array(meta_data_obj.meta_data)) + reshaped_meta_array = self._to_standard_index(meta_array, tile_data.shape) + meta_data[name] = reshaped_meta_array + + return latitude_data, longitude_data, time_data, tile_data, meta_data else: - raise NotImplementedError("Only supports grid_tile and swath_tile") + raise NotImplementedError("Only supports grid_tile, swath_tile, and time_series_tile") @staticmethod def _to_standard_index(data_array, desired_shape): http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/data-access/requirements.txt ---------------------------------------------------------------------- diff --git a/data-access/requirements.txt b/data-access/requirements.txt index 9897e8b..2bcec51 100644 --- a/data-access/requirements.txt +++ b/data-access/requirements.txt @@ -14,7 +14,7 @@ futures==3.1.1 ipython==5.3.0 ipython-genutils==0.2.0 jmespath==0.9.3 -nexusproto==0.3 +nexusproto==0.4 numpy==1.11.1 pathlib2==2.2.1 pexpect==4.2.1 http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/data-access/setup.py ---------------------------------------------------------------------- diff --git a/data-access/setup.py b/data-access/setup.py index b2d88c0..7b71df2 100644 --- a/data-access/setup.py +++ b/data-access/setup.py @@ -25,7 +25,7 @@ setuptools.setup( 'cassandra-driver==3.5.0', 'solrpy==0.9.7', 'requests', - 'nexusproto', + 'nexusproto==0.4', 'shapely' ], http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/groovy-scripts/add-day-of-year-attribute.groovy ---------------------------------------------------------------------- diff --git a/nexus-ingest/groovy-scripts/add-day-of-year-attribute.groovy b/nexus-ingest/groovy-scripts/add-day-of-year-attribute.groovy index daf533a..93a23c1 100644 --- a/nexus-ingest/groovy-scripts/add-day-of-year-attribute.groovy +++ b/nexus-ingest/groovy-scripts/add-day-of-year-attribute.groovy @@ -7,7 +7,7 @@ */ @Grapes([ - @Grab(group = 'org.nasa.jpl.nexus', module = 'nexus-messages', version = '1.0.0.RELEASE') + @Grab(group = 'org.nasa.jpl.nexus', module = 'nexus-messages', version = '1.1.0.RELEASE') ]) import org.nasa.jpl.nexus.ingest.wiretypes.NexusContent http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/groovy-scripts/add-time-from-granulename.groovy ---------------------------------------------------------------------- diff --git a/nexus-ingest/groovy-scripts/add-time-from-granulename.groovy b/nexus-ingest/groovy-scripts/add-time-from-granulename.groovy index 1591018..fe27336 100644 --- a/nexus-ingest/groovy-scripts/add-time-from-granulename.groovy +++ b/nexus-ingest/groovy-scripts/add-time-from-granulename.groovy @@ -7,7 +7,7 @@ */ @Grapes([ - @Grab(group = 'org.nasa.jpl.nexus', module = 'nexus-messages', version = '1.0.0.RELEASE') + @Grab(group = 'org.nasa.jpl.nexus', module = 'nexus-messages', version = '1.1.0.RELEASE') ]) import org.nasa.jpl.nexus.ingest.wiretypes.NexusContent http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/groovy-scripts/generate-tile-id.groovy ---------------------------------------------------------------------- diff --git a/nexus-ingest/groovy-scripts/generate-tile-id.groovy b/nexus-ingest/groovy-scripts/generate-tile-id.groovy index 7c4d7de..ebf8105 100644 --- a/nexus-ingest/groovy-scripts/generate-tile-id.groovy +++ b/nexus-ingest/groovy-scripts/generate-tile-id.groovy @@ -7,7 +7,7 @@ */ @Grapes([ - @Grab(group = 'org.nasa.jpl.nexus', module = 'nexus-messages', version = '1.0.0.RELEASE') + @Grab(group = 'org.nasa.jpl.nexus', module = 'nexus-messages', version = '1.1.0.RELEASE') ]) import org.nasa.jpl.nexus.ingest.wiretypes.NexusContent http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/groovy-scripts/nexustile-to-string.groovy ---------------------------------------------------------------------- diff --git a/nexus-ingest/groovy-scripts/nexustile-to-string.groovy b/nexus-ingest/groovy-scripts/nexustile-to-string.groovy index 39030e7..b652e65 100644 --- a/nexus-ingest/groovy-scripts/nexustile-to-string.groovy +++ b/nexus-ingest/groovy-scripts/nexustile-to-string.groovy @@ -8,7 +8,7 @@ @Grapes([ - @Grab(group = 'org.nasa.jpl.nexus', module = 'nexus-messages', version = '1.0.0.RELEASE') + @Grab(group = 'org.nasa.jpl.nexus', module = 'nexus-messages', version = '1.1.0.RELEASE') ]) import org.nasa.jpl.nexus.ingest.wiretypes.NexusContent http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/groovy-scripts/set-dataset-name.groovy ---------------------------------------------------------------------- diff --git a/nexus-ingest/groovy-scripts/set-dataset-name.groovy b/nexus-ingest/groovy-scripts/set-dataset-name.groovy index ce2f6a2..7c203eb 100644 --- a/nexus-ingest/groovy-scripts/set-dataset-name.groovy +++ b/nexus-ingest/groovy-scripts/set-dataset-name.groovy @@ -7,7 +7,7 @@ */ @Grapes([ - @Grab(group = 'org.nasa.jpl.nexus', module = 'nexus-messages', version = '1.0.0.RELEASE') + @Grab(group = 'org.nasa.jpl.nexus', module = 'nexus-messages', version = '1.1.0.RELEASE') ]) import org.nasa.jpl.nexus.ingest.wiretypes.NexusContent http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/nexus-messages/build.gradle ---------------------------------------------------------------------- diff --git a/nexus-ingest/nexus-messages/build.gradle b/nexus-ingest/nexus-messages/build.gradle index 5776362..6679cc4 100644 --- a/nexus-ingest/nexus-messages/build.gradle +++ b/nexus-ingest/nexus-messages/build.gradle @@ -87,7 +87,7 @@ apply plugin: 'project-report' group = 'org.nasa.jpl.nexus' -version = '1.0.0.RELEASE' +version = '1.1.0.RELEASE' ext{ genDirectory = "$projectDir/gen" http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/nexus-messages/src/main/proto/NexusContent.proto ---------------------------------------------------------------------- diff --git a/nexus-ingest/nexus-messages/src/main/proto/NexusContent.proto b/nexus-ingest/nexus-messages/src/main/proto/NexusContent.proto index ea83c9f..856a48b 100644 --- a/nexus-ingest/nexus-messages/src/main/proto/NexusContent.proto +++ b/nexus-ingest/nexus-messages/src/main/proto/NexusContent.proto @@ -27,6 +27,19 @@ message SwathTile{ } +message TimeSeriesTile{ + + optional ShapedArray latitude = 1; + optional ShapedArray longitude = 2; + + optional int64 time = 3; + + optional ShapedArray variable_data = 4; + + repeated MetaData meta_data = 5; + +} + message MetaData{ required string name = 1; required ShapedArray meta_data = 2; @@ -84,6 +97,7 @@ message TileData{ oneof tile_type{ GridTile grid_tile = 2; SwathTile swath_tile = 3; + TimeSeriesTile time_series_tile = 4; } } http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/nexus-messages/src/main/python/nexusproto/setup.py ---------------------------------------------------------------------- diff --git a/nexus-ingest/nexus-messages/src/main/python/nexusproto/setup.py b/nexus-ingest/nexus-messages/src/main/python/nexusproto/setup.py index 53ea282..5601cfa 100644 --- a/nexus-ingest/nexus-messages/src/main/python/nexusproto/setup.py +++ b/nexus-ingest/nexus-messages/src/main/python/nexusproto/setup.py @@ -4,7 +4,7 @@ California Institute of Technology. All rights reserved """ from setuptools import setup -__version__ = '0.3' +__version__ = '0.4' setup( name='nexusproto', http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/nexus-sink/build.gradle ---------------------------------------------------------------------- diff --git a/nexus-ingest/nexus-sink/build.gradle b/nexus-ingest/nexus-sink/build.gradle index 5f31265..a551e18 100644 --- a/nexus-ingest/nexus-sink/build.gradle +++ b/nexus-ingest/nexus-sink/build.gradle @@ -101,7 +101,7 @@ ext { springDataCassandraVersion = '1.3.4.RELEASE' springDataSolrVersion = '2.0.2.RELEASE' - nexusMessagesVersion = '1.0.0.RELEASE' + nexusMessagesVersion = '1.1.0.RELEASE' testversions = [ cassandraUnitVersion: '2.1.3.1', http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/nexus-xd-python-modules/nexusxd/tilereadingprocessor.py ---------------------------------------------------------------------- diff --git a/nexus-ingest/nexus-xd-python-modules/nexusxd/tilereadingprocessor.py b/nexus-ingest/nexus-xd-python-modules/nexusxd/tilereadingprocessor.py index 51474fd..aacdbcf 100644 --- a/nexus-ingest/nexus-xd-python-modules/nexusxd/tilereadingprocessor.py +++ b/nexus-ingest/nexus-xd-python-modules/nexusxd/tilereadingprocessor.py @@ -23,6 +23,8 @@ latitude = environ['LATITUDE'] longitude = environ['LONGITUDE'] reader_type = environ['READER'] +str(numpy.square(int('2'))) + # Optional variables for all reader types try: temp_dir = environ['TEMP_DIR'] @@ -46,6 +48,7 @@ try: except KeyError: time_offset = None + @contextmanager def closing(thing): try: @@ -159,7 +162,8 @@ def read_grid_data(self, section_spec_dataset): if time is not None: timevar = ds[time] # Note assumption is that index of time is start value in dimtoslice - tile.time = to_seconds_from_epoch(timevar[dimtoslice[time].start], timeunits=timevar.getncattr('units'), timeoffset=time_offset) + tile.time = to_seconds_from_epoch(timevar[dimtoslice[time].start], timeunits=timevar.getncattr('units'), + timeoffset=time_offset) nexus_tile = new_nexus_tile(file_path, section_spec) nexus_tile.tile.grid_tile.CopyFrom(tile) @@ -220,10 +224,52 @@ def read_swath_data(self, section_spec_dataset): remove(file_path) +def read_time_series_data(self, section_spec_dataset): + tile_specifications, file_path = parse_input(section_spec_dataset) + + time = environ['TIME'] + + with Dataset(file_path) as ds: + for section_spec, dimtoslice in tile_specifications: + tile = nexusproto.TimeSeriesTile() + + instance_dimension = next(iter([dim for dim in ds[variable_to_read].dimensions if dim != time])) + + tile.latitude.CopyFrom(to_shaped_array(numpy.ma.filled(ds[latitude][dimtoslice[instance_dimension]], numpy.NaN))) + + tile.longitude.CopyFrom(to_shaped_array(numpy.ma.filled(ds[longitude][dimtoslice[instance_dimension]], numpy.NaN))) + + # Before we read the data we need to make sure the dimensions are in the proper order so we don't have any + # indexing issues + ordered_slices = get_ordered_slices(ds, variable_to_read, dimtoslice) + # Read data using the ordered slices, replacing masked values with NaN + data_array = numpy.ma.filled(ds[variable_to_read][tuple(ordered_slices.itervalues())], numpy.NaN) + + tile.variable_data.CopyFrom(to_shaped_array(data_array)) + + if metadata is not None: + tile.meta_data.add().CopyFrom(to_metadata(metadata, ds[metadata][tuple(ordered_slices.itervalues())])) + + timevar = ds[time] + # Note assumption is that index of time is start value in dimtoslice + tile.time = to_seconds_from_epoch(timevar[dimtoslice[time].start], timeunits=timevar.getncattr('units'), + timeoffset=time_offset) + + nexus_tile = new_nexus_tile(file_path, section_spec) + nexus_tile.tile.time_series_tile.CopyFrom(tile) + + yield nexus_tile.SerializeToString() + + # If temp dir is defined, delete the temporary file + if temp_dir is not None: + remove(file_path) + + def start(): reader_types = { 'GRIDTILE': read_grid_data, - 'SWATHTILE': read_swath_data + 'SWATHTILE': read_swath_data, + 'TIMESERIES': read_time_series_data } try: http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/nexus-xd-python-modules/requirements.txt ---------------------------------------------------------------------- diff --git a/nexus-ingest/nexus-xd-python-modules/requirements.txt b/nexus-ingest/nexus-xd-python-modules/requirements.txt index a8cd6c7..020b705 100644 --- a/nexus-ingest/nexus-xd-python-modules/requirements.txt +++ b/nexus-ingest/nexus-xd-python-modules/requirements.txt @@ -6,7 +6,7 @@ docutils==0.14 futures==3.1.1 jmespath==0.9.3 netCDF4==1.2.7 -nexusproto==0.3 +nexusproto==0.4 -e git+https://github.com/dataplumber/nexus.git@979d63734017714fc0f2d4a9f378b773625996c4#egg=nexusxd&subdirectory=nexus-ingest/nexus-xd-python-modules numpy==1.12.1 protobuf==3.2.0 http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/nexus-xd-python-modules/tests/datafiles/not_empty_wswm.nc ---------------------------------------------------------------------- diff --git a/nexus-ingest/nexus-xd-python-modules/tests/datafiles/not_empty_wswm.nc b/nexus-ingest/nexus-xd-python-modules/tests/datafiles/not_empty_wswm.nc new file mode 100644 index 0000000..772bbcb Binary files /dev/null and b/nexus-ingest/nexus-xd-python-modules/tests/datafiles/not_empty_wswm.nc differ http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/nexus-xd-python-modules/tests/hd5splitter.py ---------------------------------------------------------------------- diff --git a/nexus-ingest/nexus-xd-python-modules/tests/hd5splitter.py b/nexus-ingest/nexus-xd-python-modules/tests/hd5splitter.py index 2118ccf..a0670d1 100644 --- a/nexus-ingest/nexus-xd-python-modules/tests/hd5splitter.py +++ b/nexus-ingest/nexus-xd-python-modules/tests/hd5splitter.py @@ -54,12 +54,13 @@ def hd5_copy(source, dest): def netcdf_subset(source, dest): dtime = dest.createDimension(dimname=TIME, size=TIME_SLICE.stop - TIME_SLICE.start) - dlat = dest.createDimension(dimname=LATITUDE, size=LATITUDE_SLICE.stop - LATITUDE_SLICE.start) - dlon = dest.createDimension(dimname=LONGITUDE, size=LONGITUDE_SLICE.stop - LONGITUDE_SLICE.start) + # dlat = dest.createDimension(dimname=LATITUDE, size=LATITUDE_SLICE.stop - LATITUDE_SLICE.start) + # dlon = dest.createDimension(dimname=LONGITUDE, size=LONGITUDE_SLICE.stop - LONGITUDE_SLICE.start) + drivid = dest.createDimension(dimname='rivid', size=LONGITUDE_SLICE.stop - LONGITUDE_SLICE.start) dest.setncatts(source.__dict__) - for variable in source.variables: + for variable in [ v for v in source.variables if v in ['Qout', TIME, LONGITUDE, LATITUDE]]: variable = source[variable] if variable.name == TIME: @@ -67,18 +68,18 @@ def netcdf_subset(source, dest): dest[variable.name].setncatts(variable.__dict__) dvar[:] = variable[TIME_SLICE] elif variable.name == LONGITUDE: - dvar = dest.createVariable(varname=variable.name, datatype=variable.dtype, dimensions=(dlon.name,)) + dvar = dest.createVariable(varname=variable.name, datatype=variable.dtype, dimensions=(drivid.name,)) dest[variable.name].setncatts(variable.__dict__) dvar[:] = variable[LONGITUDE_SLICE] elif variable.name == LATITUDE: - dvar = dest.createVariable(varname=variable.name, datatype=variable.dtype, dimensions=(dlat.name,)) + dvar = dest.createVariable(varname=variable.name, datatype=variable.dtype, dimensions=(drivid.name,)) dest[variable.name].setncatts(variable.__dict__) dvar[:] = variable[LATITUDE_SLICE] else: dvar = dest.createVariable(varname=variable.name, datatype=variable.dtype, - dimensions=(dtime.name, dlon.name, dlat.name)) + dimensions=(dtime.name, drivid.name)) dest[variable.name].setncatts(variable.__dict__) - dvar[:] = variable[TIME_SLICE, LONGITUDE_SLICE, LATITUDE_SLICE] + dvar[:] = variable[TIME_SLICE, LONGITUDE_SLICE] dest.sync() dest.close() @@ -86,19 +87,19 @@ def netcdf_subset(source, dest): from netCDF4 import Dataset -LATITUDE = 'Latitude' -LATITUDE_SLICE = slice(0, 26) -LONGITUDE = 'Longitude' -LONGITUDE_SLICE = slice(0, 80) -TIME = 'Time' +LATITUDE = 'lat' +LATITUDE_SLICE = slice(0, 1000) +LONGITUDE = 'lon' +LONGITUDE_SLICE = slice(0, 1000) +TIME = 'time' TIME_SLICE = slice(0, 1) hinput = Dataset( - '/Users/greguska/data/measures_alt/avg-regrid1x1-ssh_grids_v1609_201701.nc', + '/Users/greguska/data/swot_example/latest/Qout_WSWM_729days_p0_dtR900s_n1_preonly_20160416.nc', 'r') houtput = Dataset( - '/Users/greguska/data/measures_alt/avg-regrid1x1-ssh_grids_v1609_201701.split.nc', + '/Users/greguska/data/swot_example/latest/Qout_WSWM_729days_p0_dtR900s_n1_preonly_20160416.split.nc', mode='w') netcdf_subset(hinput, houtput) http://git-wip-us.apache.org/repos/asf/incubator-sdap-nexus/blob/9b74bc66/nexus-ingest/nexus-xd-python-modules/tests/tilereadingprocessor_test.py ---------------------------------------------------------------------- diff --git a/nexus-ingest/nexus-xd-python-modules/tests/tilereadingprocessor_test.py b/nexus-ingest/nexus-xd-python-modules/tests/tilereadingprocessor_test.py index 81605dd..88531d8 100644 --- a/nexus-ingest/nexus-xd-python-modules/tests/tilereadingprocessor_test.py +++ b/nexus-ingest/nexus-xd-python-modules/tests/tilereadingprocessor_test.py @@ -426,6 +426,61 @@ class TestReadAvhrrData(unittest.TestCase): np.ma.masked_invalid(from_shaped_array(results[0].tile.grid_tile.variable_data))[0, 0, 0], places=3) +class TestReadWSWMData(unittest.TestCase): + def setUp(self): + environ['READER'] = 'TIMESERIES' + environ['INBOUND_PORT'] = '7890' + environ['OUTBOUND_PORT'] = '7891' + environ['VARIABLE'] = 'Qout' + environ['LONGITUDE'] = 'lon' + environ['TIME'] = 'time' + environ['LATITUDE'] = 'lat' + + self.module = importlib.import_module('nexusxd.tilereadingprocessor') + reload(self.module) + + def tearDown(self): + del environ['READER'] + del environ['INBOUND_PORT'] + del environ['OUTBOUND_PORT'] + del environ['VARIABLE'] + del environ['LONGITUDE'] + del environ['TIME'] + del environ['LATITUDE'] + + def test_read_not_empty_wswm(self): + test_file = path.join(path.dirname(__file__), 'datafiles', 'not_empty_wswm.nc') + + results = list(self.module.read_time_series_data(None, + "time:0:1,rivid:0:500;time:0:1,rivid:500:1000;file://%s" % test_file)) + + self.assertEquals(2, len(results)) + + results = [nexusproto.NexusTile.FromString(nexus_tile_data) for nexus_tile_data in results] + + for nexus_tile in results: + self.assertTrue(nexus_tile.HasField('tile')) + self.assertTrue(nexus_tile.tile.HasField('time_series_tile')) + + tile = nexus_tile.tile.time_series_tile + self.assertEquals(500, from_shaped_array(tile.latitude).size) + self.assertEquals(500, from_shaped_array(tile.longitude).size) + self.assertEquals((1, 500), from_shaped_array(tile.variable_data).shape) + + tile1_data = np.ma.masked_invalid(from_shaped_array(results[0].tile.time_series_tile.variable_data)) + self.assertEquals(500, np.ma.count(tile1_data)) + self.assertAlmostEquals(41.390, + np.ma.min(np.ma.masked_invalid(from_shaped_array(results[0].tile.time_series_tile.latitude))), + places=3) + self.assertAlmostEquals(42.071, + np.ma.max(np.ma.masked_invalid(from_shaped_array(results[0].tile.time_series_tile.latitude))), + places=3) + + self.assertEquals(852098400L, results[0].tile.time_series_tile.time) + self.assertAlmostEquals(0.009, + np.ma.masked_invalid(from_shaped_array(results[0].tile.time_series_tile.variable_data))[0, 0], + places=3) + if __name__ == '__main__': unittest.main()
