Skip to content

Commit

Permalink
Merge pull request #35 from OphidiaBigData/feature-subset
Browse files Browse the repository at this point in the history
Drop deprecated 'subset2' method from cube
  • Loading branch information
eldoo authored Aug 2, 2021
2 parents d49561a + bc2edf4 commit 0b8651f
Showing 1 changed file with 1 addition and 86 deletions.
87 changes: 1 addition & 86 deletions PyOphidia/cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,6 @@ class Cube:
subset(subset_dims='none', subset_filter='all', container='-', exec_mode='sync', subset_type='index',
time_filter='yes', offset=0, grid='-', ncores=1, nthreads=1, schedule=0, description='-', check_grid='no', display=False)
-> Cube or None : wrapper of the operator OPH_SUBSET
subset2(subset_dims='none', subset_filter='all', grid='-', container='-', ncores=1, exec_mode='sync', schedule=0, time_filter='yes', offset=0,
description='-', check_grid='no', display=False)
-> Cube or None : wrapper of the operator OPH_SUBSET2. (Deprecated since Ophidia v1.1)
to_b2drop(cdd=None, auth_path='-', dst_path='-', ncores=1, export_metadata='yes')
-> None : method that integrates the features of OPH_EXPORTNC2 and OPH_B2DROP operators to upload a cube to B2DROP as a NetCDF file
unpublish( exec_mode='sync', display=False)
-> None : wrapper of the operator OPH_UNPUBLISH
Expand Down Expand Up @@ -5106,86 +5101,6 @@ def subset(
else:
return newcube

def subset2(
self, ncores=1, exec_mode="sync", schedule=0, subset_dims="none", subset_filter="all", time_filter="yes", offset=0, grid="-", container="-", description="-", check_grid="no", display=False
):
"""subset2(subset_dims='none', subset_filter='all', grid='-', container='-', ncores=1, exec_mode='sync', schedule=0, time_filter='yes', offset=0, description='-',
check_grid='no', display=False)
-> Cube or None : wrapper of the operator OPH_SUBSET2 (Deprecated since Ophidia v1.1)
:param ncores: number of cores to use
:type ncores: int
:param exec_mode: async or sync
:type exec_mode: str
:param schedule: 0
:type schedule: int
:param subset_dims: pipe (|) separated list of dimensions on which to apply the subsetting
:type subset_dims: str
:param subset_filter: pipe (|) separated list of filters, one per dimension, composed of comma-separated microfilters on dimension values (e.g. 30,5,10:50)
:type subset_filter: str
:param time_filter: yes|no
:type time_filter: str
:param offset: added to the bounds of subset intervals
:type offset: int
:param grid: optional argument used to identify the grid of dimensions to be used or the one to be created
:type grid: str
:param container: name of the container to be used to store the output cube, by default it is the input container
:type container: str
:param description: additional description to be associated with the output cube
:type description: str
:param check_grid: yes|no
:type check_grid: str
:param display: option for displaying the response in a "pretty way" using the pretty_print function (default is False)
:type display: bool
:returns: new cube or None
:rtype: Cube or None
:raises: RuntimeError
"""

if Cube.client is None or self.pid is None:
raise RuntimeError("Cube.client or pid is None")
newcube = None

query = "oph_subset2 "

if ncores is not None:
query += "ncores=" + str(ncores) + ";"
if exec_mode is not None:
query += "exec_mode=" + str(exec_mode) + ";"
if schedule is not None:
query += "schedule=" + str(schedule) + ";"
if subset_dims is not None:
query += "subset_dims=" + str(subset_dims) + ";"
if subset_filter is not None:
query += "subset_filter=" + str(subset_filter) + ";"
if time_filter is not None:
query += "time_filter=" + str(time_filter) + ";"
if offset is not None:
query += "offset=" + str(offset) + ";"
if grid is not None:
query += "grid=" + str(grid) + ";"
if container is not None:
query += "container=" + str(container) + ";"
if description is not None:
query += "description=" + str(description) + ";"
if check_grid is not None:
query += "check_grid=" + str(check_grid) + ";"

query += "cube=" + str(self.pid) + ";"

try:
if Cube.client.submit(query, display) is None:
raise RuntimeError()

if Cube.client.last_response is not None:
if Cube.client.cube:
newcube = Cube(pid=Cube.client.cube)
except Exception as e:
print(get_linenumber(), "Something went wrong:", e)
raise RuntimeError()
else:
return newcube

def to_b2drop(self, cdd=None, auth_path="-", dst_path="-", ncores=1, export_metadata="yes"):
"""to_b2drop(cdd=None, auth_path='-', dst_path='-', ncores=1, export_metadata='yes')
-> None : method that integrates the features of OPH_EXPORTNC2 and OPH_B2DROP operators to upload a cube to B2DROP as a NetCDF file
Expand Down Expand Up @@ -5234,7 +5149,7 @@ def to_b2drop(self, cdd=None, auth_path="-", dst_path="-", ncores=1, export_meta
print(get_linenumber(), "Something went wrong:", e)
raise RuntimeError()

def export_array(self, show_id="no", show_time="no", subset_dims=None, subset_filter=None, time_filter="no"):
def export_array(self, show_id='no', show_time='no', subset_dims=None, subset_filter=None, time_filter='no'):
"""export_array(show_id='no', show_time='no', subset_dims=None, subset_filter=None, time_filter='no') -> dict or None : wrapper of the operator OPH_EXPLORECUBE
:param show_id: yes|no
Expand Down

0 comments on commit 0b8651f

Please sign in to comment.