Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise errors when trying to request local grids on wrong grid types #198

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@

class HealpixGridMapper(DatacubeMapper):
def __init__(self, base_axis, mapped_axes, resolution, local_area=[]):
# TODO: if local area is not empty list, raise NotImplemented
self._mapped_axes = mapped_axes
self._base_axis = base_axis
self._resolution = resolution
self._axis_reversed = {mapped_axes[0]: True, mapped_axes[1]: False}
self._first_axis_vals = self.first_axis_vals()
self.compressed_grid_axes = [self._mapped_axes[1]]

if local_area != []:
raise NotImplementedError("Local area grid not implemented for healpix grids")

def first_axis_vals(self):
rad2deg = 180 / math.pi
vals = [0] * (4 * self._resolution - 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

class NestedHealpixGridMapper(DatacubeMapper):
def __init__(self, base_axis, mapped_axes, resolution, local_area=[]):
# TODO: if local area is not empty list, raise NotImplemented
self._mapped_axes = mapped_axes
self._base_axis = base_axis
self._resolution = resolution
Expand All @@ -18,6 +17,9 @@ def __init__(self, base_axis, mapped_axes, resolution, local_area=[]):
self.Npix = 12 * self.Nside * self.Nside
self.Ncap = (self.Nside * (self.Nside - 1)) << 1

if local_area != []:
raise NotImplementedError("Local area grid not implemented for healpix grids")

def first_axis_vals(self):
rad2deg = 180 / math.pi
vals = [0] * (4 * self._resolution - 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

class LocalRegularGridMapper(DatacubeMapper):
def __init__(self, base_axis, mapped_axes, resolution, local_area=[]):
# TODO: if local area is not empty list, raise NotImplemented
self._mapped_axes = mapped_axes
self._base_axis = base_axis

if local_area == [] or len(local_area) != 4:
raise TypeError("Local area grid region not or wrongly specified")

self._first_axis_min = local_area[0]
self._first_axis_max = local_area[1]
self._second_axis_min = local_area[2]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

class OctahedralGridMapper(DatacubeMapper):
def __init__(self, base_axis, mapped_axes, resolution, local_area=[]):
# TODO: if local area is not empty list, raise NotImplemented
self._mapped_axes = mapped_axes
self._base_axis = base_axis
self._resolution = resolution
Expand All @@ -16,6 +15,9 @@ def __init__(self, base_axis, mapped_axes, resolution, local_area=[]):
self._axis_reversed = {mapped_axes[0]: True, mapped_axes[1]: False}
self.compressed_grid_axes = [self._mapped_axes[1]]

if local_area != []:
raise NotImplementedError("Local area grid not implemented for octahedral grids")

def gauss_first_guess(self):
i = 0
gvals = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@

class ReducedLatLonMapper(DatacubeMapper):
def __init__(self, base_axis, mapped_axes, resolution, local_area=[]):
# TODO: if local area is not empty list, raise NotImplemented
self._mapped_axes = mapped_axes
self._base_axis = base_axis
self._resolution = resolution
self._axis_reversed = {mapped_axes[0]: False, mapped_axes[1]: False}
self._first_axis_vals = self.first_axis_vals()
self.compressed_grid_axes = [self._mapped_axes[1]]

if local_area != []:
raise NotImplementedError("Local area grid not implemented for reduce lat-lon grids")

def first_axis_vals(self):
resolution = 180 / (self._resolution - 1)
vals = [-90 + i * resolution for i in range(self._resolution)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

class RegularGridMapper(DatacubeMapper):
def __init__(self, base_axis, mapped_axes, resolution, local_area=[]):
# TODO: if local area is not empty list, raise NotImplemented
self._mapped_axes = mapped_axes
self._base_axis = base_axis
self._resolution = resolution
Expand All @@ -14,6 +13,9 @@ def __init__(self, base_axis, mapped_axes, resolution, local_area=[]):
self._first_axis_vals = self.first_axis_vals()
self.compressed_grid_axes = [self._mapped_axes[1]]

if local_area != []:
raise TypeError("Use local_regular grid type for local area regular lat-lon grids")

def first_axis_vals(self):
first_ax_vals = [90 - i * self.deg_increment for i in range(2 * self._resolution)]
return first_ax_vals
Expand Down
1 change: 0 additions & 1 deletion polytope/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class Config(ConfigModel):
class PolytopeOptions(ABC):
@staticmethod
def get_polytope_options(options):

parser = argparse.ArgumentParser(allow_abbrev=False)
conflator = Conflator(app_name="polytope", model=Config, cli=False, argparser=parser, **options)
config_options = conflator.load()
Expand Down
Loading