Skip to content

Commit ff51bf7

Browse files
RKuttruffStepheny Perezrileykkstephenykpkevinmarlis
authored
Release 1.4.0 (#331)
* SDAP-493: Pagination improvements (#282) * removed resultSizeLimit param from matchup * Add # of primaries/avergae secondaries to job output * rename to executionId * update changelog * add totalSecondaryMatched field to /job output * num unique secondaries addition * updated docs to use correct sea_water_temperature param name * bugfix * fix division by zero bug * SDAP-500: Improvements to SDAP Asynchronous Jobs (#287) * removed resultSizeLimit param from matchup * Add # of primaries/avergae secondaries to job output * rename to executionId * update changelog * add totalSecondaryMatched field to /job output * num unique secondaries addition * updated docs to use correct sea_water_temperature param name * bugfix * fix division by zero bug * pagination improvements * removed debugging line * changelog * Update helm cassandra dependency (#289) * Update helm cassandra dependency * Bump default cassandra PV to 4 * Bump default cassandra PV to 4 in tools * Changelog * Fixed small documentation issue --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * update changelog * rename key to executionID --------- Co-authored-by: Riley Kuttruff <72955101+RKuttruff@users.noreply.github.com> Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * SDAP-499: Add page number to default filename for matchup output (#288) * removed resultSizeLimit param from matchup * Add # of primaries/avergae secondaries to job output * rename to executionId * update changelog * add totalSecondaryMatched field to /job output * num unique secondaries addition * updated docs to use correct sea_water_temperature param name * bugfix * fix division by zero bug * add page number to default filename for matchup output * pagination improvements * removed debugging line * changelog * Update helm cassandra dependency (#289) * Update helm cassandra dependency * Bump default cassandra PV to 4 * Bump default cassandra PV to 4 in tools * Changelog * Fixed small documentation issue --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Revert "Update helm cassandra dependency (#289)" This reverts commit 1e8cc4e. * changelog --------- Co-authored-by: Riley Kuttruff <72955101+RKuttruff@users.noreply.github.com> Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * SDAP-506: STAC Catalog for Matchup outputs (#291) * removed resultSizeLimit param from matchup * Add # of primaries/avergae secondaries to job output * rename to executionId * update changelog * add totalSecondaryMatched field to /job output * num unique secondaries addition * updated docs to use correct sea_water_temperature param name * bugfix * fix division by zero bug * add page number to default filename for matchup output * pagination improvements * removed debugging line * changelog * Update helm cassandra dependency (#289) * Update helm cassandra dependency * Bump default cassandra PV to 4 * Bump default cassandra PV to 4 in tools * Changelog * Fixed small documentation issue --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * stac catalog * Updated openapi spec * move stac endpoints to matchup tag in openapi spec * Revert "Update helm cassandra dependency (#289)" This reverts commit 1e8cc4e. * fix bug where still-running jobs failed /job endpoint due to missing metadata * Update .asf.yaml (#293) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * update changelog * re-add removed changelog entry --------- Co-authored-by: Riley Kuttruff <72955101+RKuttruff@users.noreply.github.com> Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * SDAP-508 report sat spatial extents (#295) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * SDAP-505: Support DOMS insitu API (#299) * support DOMS insitu API * update NCAR insitu url * add endpoint for getting insitu units * SDAP-472 - data-access overhaul to support multiple simultaneous data backends (#294) * Separated NTS backends * n/a * More nts backend stuff * Working(?) np backend * Working(?) np backend * gitignore ini * ASF headers * First functioning test of 2 simultaneous backends * Removed accidentally committed ini files * Working zarr backend ds list + datasets are no longer case sensitive + handling for failed zarr ds opens (bad path, bad creds, &c) * Capture and handle NTS requests routed to backend that doesn't (yet) support them * analysis setup fails to find VERSION.txt when building locally * Implemented more NTS functions in zarr backend * Added misc backend time metrics record field in NCSH * fixes * Dynamic dataset management * Dynamic dataset management * Dataset management * Timeseriesspark support * Update backend dict on dataset mgmt query * Fixes and improvements * Adapted matchup to work with zarr backends * Zarr support - Distinct slices of time is now default - No longer assuming+shaping as multivar tiles unless needed * DDAS adjustments * find_tile_by_polygon_and_most_recent_day_of_year impl * Don't sel by time if neither max nor min time are given * Fix not calling partial when needed * Pinned s3fs and fsspec versions * Fixed some dependencies to ensure image builds properly + s3fs works * Config override for backends * Deps update * Add metadata from Zarr collection to /list * Zarr: Probe lat order and flip if necessary * Strip quotes from variable names CM can sometimes publish with extra quotes resulting in KeyErrors * removed resultSizeLimit param from matchup * Add # of primaries/avergae secondaries to job output * rename to executionId * update changelog * add totalSecondaryMatched field to /job output * num unique secondaries addition * updated docs to use correct sea_water_temperature param name * bugfix * fix division by zero bug * add params to dataset management handler classes * add page number to default filename for matchup output * pagination improvements * removed debugging line * changelog * Update helm cassandra dependency (#289) * Update helm cassandra dependency * Bump default cassandra PV to 4 * Bump default cassandra PV to 4 in tools * Changelog * Fixed small documentation issue --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * stac catalog * Updated openapi spec * move stac endpoints to matchup tag in openapi spec * SDAP-507 - Changes to remove geos sub-dependency * SDAP-507 - Changelog * SDAP-507 - Changes to remove geos sub-dependency * SDAP-507 - Changelog * delete instead of comment out * Revert "Update helm cassandra dependency (#289)" This reverts commit 1e8cc4e. * deleted disabled endpoint files * fix bug where still-running jobs failed /job endpoint due to missing metadata * Update .asf.yaml (#293) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Moved changelog entries * SDAP-472 changelog entries --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> Co-authored-by: skorper <stepheny.k.perez@gmail.com> * Merge master into develop post-1.2.0 release (#305) * Update .asf.yaml (#293) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * domspurge patch (#280) * Fix delete query to account for PK update * Fixed mistake in domspurge readme --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Patch: Made conda dep changes accidentally omitted from geos PR * SDAP-511 - Switch package manager to poetry (#301) * Redid branch w/ correct base I tried to just rebase but it didn't work properly * Changelogs * Delete old dockerfile * Removed old conda install files * Removed version.txt to just use pyproject.toml --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * pyproject.toml dependency updates for Zarr --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> Co-authored-by: Stepheny Perez <skorper@users.noreply.github.com> * SDAP 515 - Improved handling of unreachable remote SDAPs (#308) * Improved error handling to account for any reason a remote is not reachable * Further fixes for unreachable remote SDAPs * Improved logging * SDAP-513 - Configurable Solr init pod image in helm (#306) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Added some missing ASF headers and removed some unneeded files (#302) * Remove IDE files * Added more missing headers --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Update requirements.txt (#309) * Updates to openapi (#310) * Disable the try it now button * Added additional spark algorithms * Updates to openapi to include additional algorithms * SDAP-518 - Collection Config Docs (#311) * Initial work on CC docs * Add collections to index toctree * YAML highlighting * NetCDF section * remove incubation msg from intro.rst * Added recs for gridded tile size --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * data-access patch (#313) * Patches to backend mgmt and zarr backend - Code cleanup - Added dask as dependency, so it will be leveraged with Zarr datasets - Fixed creation of tile times array from Zarr data to ensure its in seconds from 1970-01-01. Original method has been seen to produce incorrect results from bad assumptions * Changelog --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Changed SDAP startup behavior to wait for all datasets to be prepared before accepting HTTP requests (#314) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * update quickstart with updated solr command (#298) Co-authored-by: Riley Kuttruff <72955101+RKuttruff@users.noreply.github.com> * 1.3.0 to develop (#317) * Update .asf.yaml (#293) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * domspurge patch (#280) * Fix delete query to account for PK update * Fixed mistake in domspurge readme --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Patch: Made conda dep changes accidentally omitted from geos PR * SDAP-511 - Switch package manager to poetry (#301) * Redid branch w/ correct base I tried to just rebase but it didn't work properly * Changelogs * Delete old dockerfile * Removed old conda install files * Removed version.txt to just use pyproject.toml --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Update release files - 1.3.0 header in changelogs - Removed incubation DISCLAIMER - Removed incubation language from NOTICE and updated URLs - Bumped versions - Made copyright year current - Poetry re-lock * Fix Dockerfile for DISCLAIMER rm --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> Co-authored-by: Stepheny Perez <skorper@users.noreply.github.com> * SDAP-469 - Support for data with elevation (#276) * SDAP-469 - Configured timeseriesspark to have the option to bound by depth * Elevation fetch & masking untested * Elevation subsetting * fixes * Check if there's elevation when pulling the tile data * Elevation masking for tiles with no elevation does nothing * Add elevation fields to collection creation script * Name elevation fields to be dynamically typed correctly * Elevation array shape + add to nexuspoint * Add elev to data in bounds result * Improved handling of elev arguments & masking * tile elev in nexusproto backend * Docker fix * Additional algorithm support for SDAP 469 3d data (#10) * Added support for default elevation value of 0 when parameter not provided * Added support for setting min and max elevation when using single elevation arg * Added support for data ingested with elevation * Fixed logic for elevation clause when min and max elevations are equivalent * Fixed logic for elevation clause when min and max elevations are equivalent * Bug fix for missing elevation parameters * Reverted timeAvgMapSpark to use NexusRequestObject * Fixed bug with order of arguments * Commented out saving netcdf files * Bug fix for how numpy arrays are handled * Cleaned up logic for handling the different arg cases * Reworked elevation clause logic and added to polygon search * Added elevation args to find_tiles_in_polygon --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> Co-authored-by: Kevin <kevinmarlis@gmail.com> * SDAP-522 - Fixes for broken endpoints found by work for SDAP-521 (#319) * Implemented fixes * Changelog --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Error handling on ds listing for zarr (#320) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * SDAP-319 - Fixed typo (#322) * Added forgotten changelog entry (#321) Forgot from PR #276 * [SDAP-492] STV-FIS tomogram data visualization support (#323) * SDAP-469 - Configured timeseriesspark to have the option to bound by depth * Elevation fetch & masking untested * Elevation subsetting * fixes * Check if there's elevation when pulling the tile data * Elevation masking for tiles with no elevation does nothing * SDAP-492 - Added dependencies + alg classes * Initial subsetting Still need to org and plot the data * Image rendering * Lon + Lat tomo fetch impls * Add elevation fields to collection creation script * Name elevation fields to be dynamically typed correctly * Elevation array shape + add to nexuspoint * WIP: Optimizations for lateral slicing (lon only so far) Untested * Elevation array shape + add to nexuspoint * Fixes * bugfix * Use actual extent in extent param * Minor improvements * More tomogram work * Render profile tomo image results using `plt.pcolormesh` instead of `plt.imshow` * SIGNIFICANT improvement of tomogram processing time * Add elev to data in bounds result * Add elev to data in bounds result * Added GIF renderer * 3D tomogram viz endpoint * Add labels * Colorbars * Add basemap below tomo render * Additional arguments and render types * Simple CSV renderer - point cloud only * Improved handling of elev arguments & masking * tile elev in nexusproto backend * poetry re-lock after deps update from merge * minor updates * Docker fix * Speed up 3d result build * poetry relock * Vertical truncation of tomograms by RH98/GND height maps * Updates: - Disabled elev tomo endpoint - Added param to render tomograms in vertically cumulative percentiles. (ie, cumulative return power for each voxel column) - Added NetCDF renderer for tomo3d endpoint * Tomo improvements * Fix for tomo 3d basemap being inverted by latitude * poetry lock * Simplified profile tomo API + added NC output formatter * Added multi-slice capability to 2d plotting * Add cbar min/max option to tomo profile rendering + better nodata error handling * Support for arbitrary line slicing of tomogram data Currently does not support multislicing * Remove accidentally committed test code * Add slicing along line to NTS w/ nexusproto implementation + tomogram arb slicing tries to use this with bbox subsetting as a fallback * Improve performance of elevation binning * Improve performance of data gridding * Update CL + remove LGPL 3 indirect dependency --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * [SDAP-497] - Release build script (#290) * Build script * Build script * Rebased onto 1.2.0 release branch to avoid messing up changelog * Retry failed builds/pushes once to avoid time loss from transient errors * Moved changelog entry * Start of src pull changes * mv build script * Better ASF pulling * Build from GitHub * Simple docs * Some cleanup, renaming, deleting unused stuff etc * Update build.py * Added build from ASF archive * Updates and fixes * Updates for post-grad changes * Add support for custom nexusproto builds from git * Build tool updates * Update changelog * Implement build from local directory --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * SDAP-520 - Guide for evaluating SDAP release candidates (#318) * SDAP-520 Added RC eval guide to RTD * remove incubator * add to toctree * Attempt to fix the many Sphinx warnings on build * Changelog --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * added primitive match return function to CDMS reader (#260) * added primitive match return function * Updated function to be used with generic use cases * Updated documentation for assemble functions * Updated documentation, removed xarray dependency * merged with develop, updated changelog * SDAP-470 Fixed CHANGELOG.md (#324) * SDAP-526 - Upgrade canopy and ground masking (#326) * Upgrade canopy and ground masking * Changelog update --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Patch to add geopy dep that was forgotten (#328) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * SDAP-527: Fixed creation of execution status Cassandra table (#329) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * SDAP-521 - Improved SDAP testing suite (#325) * SDAP-520 Added RC eval guide to RTD * remove incubator * add to toctree * Granule download script for testing * Move & update test script Made current with what was deployed for the CDMS project. Will need extensive editing. * Test script pruning + guide start * Updates * Updates * Guide for install and run * Attempt to fix the many Sphinx warnings on build * Fix bad ref * Fix bad ref * Fix bad ref (third time's the charm?) * Removal of ingested test data * Reduced datainbounds L2 test bbox to ease memory footprint * Revert "Reduced datainbounds L2 test bbox to ease memory footprint" This reverts commit 46cf5ad. * Update docs for missing test collection * SDAP-521 Updated quickstart and test guide. (#327) * SDAP-521 Updated quickstart and test guide. * SDAP-521 Updated solr start up env variables to be consistent with helm chart. * SDAP-521 Updated README.md --------- Co-authored-by: rileykk <rileykk@jpl.nasa.gov> Co-authored-by: Nga Chung <17833879+ngachung@users.noreply.github.com> * SDAP-529: Added configuration for verbose logging for collection manager in the Helm chart (#330) Co-authored-by: rileykk <rileykk@jpl.nasa.gov> * Bump versions for release * Some more version fixes * Some more version fixes * Fix doc typo * I'm having issues with the venv. This needs more testing but shouldn't be a release blocker * Final release dates to changelog * Moved incorrect CL entry to proper section --------- Co-authored-by: Stepheny Perez <skorper@users.noreply.github.com> Co-authored-by: rileykk <rileykk@jpl.nasa.gov> Co-authored-by: skorper <stepheny.k.perez@gmail.com> Co-authored-by: Kevin <kevinmarlis@gmail.com> Co-authored-by: alovett-COAPS <113188918+alovett-COAPS@users.noreply.github.com> Co-authored-by: Nga Chung <17833879+ngachung@users.noreply.github.com>
1 parent fa359e4 commit ff51bf7

67 files changed

Lines changed: 7608 additions & 1743 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.4.0] - 2024-11-04
8+
### Added
9+
- SDAP-469: Support for three dimensional data. 2D data defaults to a layer at 0m elevation.
10+
- SDAP-492: Added some demo algorithms for working with and visualizing tomography data. Currently designed for data from airborne SAR campaigns, but can be readily generalized.
11+
- SDAP-526: Upgrade 2D tomography endpoint canopy and ground masking feature to allow for primary and backup datasets
12+
- SDAP-497: Added tool to ease building of releases. Can build from ASF distributions, git repos, and local
13+
- SDAP-520: (Documentation) Added guide to docs for evaluating official release candidates.
14+
- SDAP-529: Added configuration for verbose logging for collection manager in the Helm chart
15+
### Changed
16+
- SDAP-470: Modified `cdms-reader` tool to support primary to secondary matchups
17+
### Deprecated
18+
### Removed
19+
### Fixed
20+
- SDAP-525: Fixed expired AWS creds for Zarr datasets breaking list endpoint
21+
- SDAP-527: Fixed incorrect initialization of `doms.doms_executions` Cassandra table, which broke `/matchup` endpoint for new installations.
22+
- SDAP-522: Fixed several broken endpoints discovered by SDAP-521 work
23+
- Fixed `/version` by updating to correct NEXUS package name
24+
- Fixed `/heartbeat` by moving heartbeat evaluations to all backends
25+
- Fixed CDMS STAC catalog pagination
26+
### Security
27+
728
## [1.3.0] - 2024-06-10
829
### Added
930
- SDAP-506:

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Apache SDAP release 1.3.0
1+
Apache SDAP release 1.4.0
22

33
This is a source distribution of Apache SDAP - NEXUS.
44

analysis/webservice/algorithms/DataInBoundsSearch.py

Lines changed: 85 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
# limitations under the License.
1515

1616

17+
import io
18+
import gzip
1719
import json
1820
import numpy
21+
import logging
1922

2023
from datetime import datetime
2124
from pytz import timezone
@@ -68,6 +71,9 @@ class DataInBoundsSearchCalcHandlerImpl(NexusCalcHandler):
6871
}
6972
singleton = True
7073

74+
def __init__(self, tile_service_factory, **kwargs):
75+
NexusCalcHandler.__init__(self, tile_service_factory, desired_projection='swath')
76+
7177
def parse_arguments(self, request):
7278
# Parse input arguments
7379

@@ -114,27 +120,68 @@ def parse_arguments(self, request):
114120
"Maximum (Northern) Latitude. 'metadataFilter' must be in the form key:value",
115121
code=400)
116122

117-
return ds, parameter_s, start_time, end_time, bounding_polygon, metadata_filter
123+
min_elevation, max_elevation = request.get_elevation_args()
124+
125+
if (min_elevation and max_elevation) and min_elevation > max_elevation:
126+
raise NexusProcessingException(
127+
reason='Min elevation must be less than or equal to max elevation',
128+
code=400
129+
)
130+
131+
compact_result = request.get_boolean_arg('compact')
132+
133+
return ds, parameter_s, start_time, end_time, bounding_polygon, metadata_filter, min_elevation, max_elevation, compact_result
118134

119135
def calc(self, computeOptions, **args):
120-
ds, parameter, start_time, end_time, bounding_polygon, metadata_filter = self.parse_arguments(computeOptions)
136+
ds, parameter, start_time, end_time, bounding_polygon,\
137+
metadata_filter, min_elevation, max_elevation, compact = self.parse_arguments(computeOptions)
121138

122139
includemeta = computeOptions.get_include_meta()
123140

141+
log = logging.getLogger(__name__)
142+
124143
min_lat = max_lat = min_lon = max_lon = None
144+
tile_service = self._get_tile_service()
145+
125146
if bounding_polygon:
126147
min_lat = bounding_polygon.bounds[1]
127148
max_lat = bounding_polygon.bounds[3]
128149
min_lon = bounding_polygon.bounds[0]
129150
max_lon = bounding_polygon.bounds[2]
130151

131-
tiles = self._get_tile_service().get_tiles_bounded_by_box(min_lat, max_lat, min_lon, max_lon, ds, start_time,
132-
end_time)
152+
tiles = tile_service.find_tiles_in_box(min_lat, max_lat, min_lon, max_lon, ds, start_time, end_time,
153+
min_elevation=min_elevation, max_elevation=max_elevation, fetch_data=False)
154+
155+
need_to_fetch = True
133156
else:
134157
tiles = self._get_tile_service().get_tiles_by_metadata(metadata_filter, ds, start_time, end_time)
158+
need_to_fetch = False
135159

136160
data = []
137-
for tile in tiles:
161+
162+
log.info(f'Matched {len(tiles):,} tiles.')
163+
164+
for i in range(len(tiles)-1, -1, -1): # tile in tiles:
165+
tile = tiles.pop(i)
166+
167+
tile_id = tile.tile_id
168+
169+
log.info(f'Processing tile {tile_id} | {i=}')
170+
171+
if need_to_fetch:
172+
tile = tile_service.fetch_data_for_tiles(tile)[0]
173+
tile = tile_service.mask_tiles_to_bbox(min_lat, max_lat, min_lon, max_lon, [tile])
174+
tile = tile_service.mask_tiles_to_time_range(start_time, end_time, tile)
175+
176+
if min_elevation is not None and max_elevation is not None:
177+
tile = tile_service.mask_tiles_to_elevation(min_elevation, max_elevation, tile)
178+
179+
if len(tile) == 0:
180+
log.info(f'Skipping empty tile {tile_id}')
181+
continue
182+
183+
tile = tile[0]
184+
138185
for nexus_point in tile.nexus_point_generator():
139186

140187
point = dict()
@@ -159,15 +206,26 @@ def calc(self, computeOptions, **args):
159206
except (KeyError, IndexError):
160207
pass
161208
else:
162-
point['variable'] = nexus_point.data_vals
209+
variables = []
210+
211+
data_vals = nexus_point.data_vals if tile.is_multi else [nexus_point.data_vals]
212+
213+
for value, variable in zip(data_vals, tile.variables):
214+
if variable.standard_name:
215+
var_name = variable.standard_name
216+
else:
217+
var_name = variable.variable_name
218+
219+
variables.append({var_name: value})
220+
221+
point['variables'] = variables
163222

164223
data.append({
165224
'latitude': nexus_point.latitude,
166225
'longitude': nexus_point.longitude,
167226
'time': nexus_point.time,
168-
'data': [
169-
point
170-
]
227+
'elevation': nexus_point.depth,
228+
'data': point
171229
})
172230

173231
if includemeta and len(tiles) > 0:
@@ -178,14 +236,22 @@ def calc(self, computeOptions, **args):
178236
result = DataInBoundsResult(
179237
results=data,
180238
stats={},
181-
meta=meta)
239+
meta=meta,
240+
compact=compact
241+
)
182242

183243
result.extendMeta(min_lat, max_lat, min_lon, max_lon, "", start_time, end_time)
184244

245+
log.info(f'Finished subsetting. Generated {len(data):,} points')
246+
185247
return result
186248

187249

188250
class DataInBoundsResult(NexusResults):
251+
def __init__(self, results=None, meta=None, stats=None, computeOptions=None, status_code=200, compact=False, **args):
252+
NexusResults.__init__(self, results, meta, stats, computeOptions, status_code, **args)
253+
self.__compact = compact
254+
189255
def toCSV(self):
190256
rows = []
191257

@@ -229,7 +295,15 @@ def toCSV(self):
229295
return "\r\n".join(rows)
230296

231297
def toJson(self):
232-
return json.dumps(self.results(), indent=4, cls=NpEncoder)
298+
if not self.__compact:
299+
return json.dumps(self.results(), indent=4, cls=NpEncoder)
300+
else:
301+
buffer = io.BytesIO()
302+
with gzip.open(buffer, 'wt', encoding='ascii') as zip:
303+
json.dump(self.results(), zip, cls=NpEncoder)
304+
305+
buffer.seek(0)
306+
return buffer.read()
233307

234308
class NpEncoder(json.JSONEncoder):
235309
def default(self, obj):

analysis/webservice/algorithms/Heartbeat.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,7 @@ class HeartbeatCalcHandlerImpl(NexusCalcHandler):
2929
singleton = True
3030

3131
def calc(self, computeOptions, **args):
32-
solrOnline = self._get_tile_service().pingSolr()
33-
34-
# Not sure how to best check cassandra cluster status so just return True for now
35-
cassOnline = True
36-
37-
if solrOnline and cassOnline:
38-
status = {"online": True}
39-
else:
40-
status = {"online": False}
32+
status = self._get_tile_service().heartbeat()
4133

4234
class SimpleResult(object):
4335
def __init__(self, result):

0 commit comments

Comments
 (0)