Skip to content

add handling of reduced_ll pl array with 0 values ie local reduced_ll… #311

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

Merged
merged 7 commits into from
Jan 28, 2025
Merged
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 @@ -22,8 +22,11 @@ def __init__(self, base_axis, mapped_axes, resolution, md5_hash=None, local_area
raise NotImplementedError("Reduced lat-lon grid with first axis in decreasing order is not supported")

def first_axis_vals(self):
start_lat = 90
if self._resolution == 3601:
start_lat = 89.973092
resolution = 180 / (self._resolution - 1)
vals = [-90 + i * resolution for i in range(self._resolution)]
vals = [round(start_lat - i * resolution, 12) for i in range(self._resolution)]
return vals

def map_first_axis(self, lower, upper):
Expand Down Expand Up @@ -5084,8 +5087,11 @@ def lon_spacing(self):
def second_axis_vals(self, first_val):
first_idx = self._first_axis_vals.index(first_val[0])
Ny = self.lon_spacing()[first_idx]
second_spacing = 360 / Ny
return [i * second_spacing for i in range(Ny)]
if Ny != 0:
second_spacing = 360 / Ny
return [i * second_spacing for i in range(Ny)]
else:
raise ValueError("Requested latitude value is not within reduced latitude-longitude grid bounds")

def map_second_axis(self, first_val, lower, upper):
axis_lines = self.second_axis_vals(first_val)
Expand Down
Loading