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

Zarr_file_example is broken #261

Open
tylere opened this issue Sep 6, 2024 · 1 comment
Open

Zarr_file_example is broken #261

tylere opened this issue Sep 6, 2024 · 1 comment

Comments

@tylere
Copy link
Collaborator

tylere commented Sep 6, 2024

Tile bounds should be extracted from the first record (code):
minx, miny, maxx, maxy = bbox.bounds.iloc[0]

Tile errors (error code 422) are occurring:
Screenshot 2024-09-06 at 4 32 24 PM

@isaacbrodsky
Copy link
Contributor

I think this is rather that the tiles that are erroring are all NaN, if you check for that you can return before

    if np.all(np.isnan(data_array)):
        # This tile is entirely NaN, so render as all zeroes
        print("All NaN")
        return None

    # Compute min and max values, excluding NaN
    valid_min = math.floor(np.nanmin(data_array))
    valid_max = math.ceil(np.nanmax(data_array))

    # Masking the NaN values and replcing with values outside min max
    masked_data = np.nan_to_num(data_array, nan=valid_min - 1)

    # Using the minmax for color mapping
    arr = utils.arr_to_plasma(masked_data, min_max=(valid_min, valid_max))
    return arr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants