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

calculate the domain cells for a given band #70

Closed
MAfarrag opened this issue Dec 28, 2023 · 0 comments · Fixed by #76
Closed

calculate the domain cells for a given band #70

MAfarrag opened this issue Dec 28, 2023 · 0 comments · Fixed by #76
Labels
enhancement New feature or request

Comments

@MAfarrag
Copy link
Member

Currently the method assumes that the dataset has only one band, but if the dataset is a multi-band the method will miscalculate or give an error.

add a band parameter to the method and use the read_array method to retrieve the array values for each band.

[pyramids] pyramids/dataset.py (Lines 1054-1067)


def count_domain_cells(self):
        """Count cells inside the domain

        Returns
        -------
        int:
            Number of cells
        """
        # count cells inside the domain
        arr = self.raster.ReadAsArray()
        domain_count = np.size(arr[:, :]) - np.count_nonzero(
            (arr[np.isclose(arr, self.no_data_value[0], rtol=0.001)])
        )
        return domain_count

Open in IDE · Open on GitHub

Created from JetBrains using CodeStream

@MAfarrag MAfarrag added the enhancement New feature or request label Jan 4, 2024
@MAfarrag MAfarrag linked a pull request Jan 4, 2024 that will close this issue
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant