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

142 add create constant raster #168

Merged
merged 11 commits into from
Aug 14, 2023
Merged

Conversation

msmiyels
Copy link
Collaborator

Creates a constant raster based on the users input value with three different options:

  1. Based on another raster
  2. Based on coordinate pair [north, west] with user-defined pixel size
  3. Based on coordinates [north, west, east, south]

Merged it into three core- and one call-function.

The output will be an integer type array, if both constant and nodata values are integers.
If only nodata is not integer, the metadata will be floating point but the array of integer type (to avoid useless decimal places when storing). In any other case, float64 will be assigned.

Let me know what you think and if you would like to split even the call functions into separate functions or keep it as it is (then, probably some code parts would be redundant).

Cheers,
Micha

Added necessary utility functions, already PRed in #98, but kept all other functions and files unchanged.

FYI: There are some errors raising up when testing, which are from different other modules.
@msmiyels msmiyels linked an issue Jul 12, 2023 that may be closed by this pull request
@msmiyels msmiyels marked this pull request as ready for review July 25, 2023 06:48
@msmiyels msmiyels self-assigned this Jul 25, 2023
Copy link
Collaborator

@nmaarnio nmaarnio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good overall. I am only wondering if the utility functions are strictly necessary, but if you have found out that they are needed or useful, I'll trust you. The public function is quite parameterized since it allows three modes with different parameter requirements, but I think having one interface for this functionality might be still the best option.

eis_toolkit/raster_processing/create_constant_raster.py Outdated Show resolved Hide resolved
Accept review suggestion. Both ways make sense, I don´t have a strong opinion about this ;)

Co-authored-by: Niko Aarnio <[email protected]>
@msmiyels
Copy link
Collaborator Author

Hey Nico, thank you for reviewing! 😀 I accepted your suggestion for unnesting the exceptions in Git, so it should be ready to go.

Copy link
Collaborator

@nmaarnio nmaarnio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, looks good now! I resolved conflicts and made a tiny lint fix, I will merge now.

@nmaarnio nmaarnio merged commit b910ada into master Aug 14, 2023
4 of 5 checks passed
@nmaarnio nmaarnio deleted the 142-add-create-constant-raster branch February 19, 2024 13:21
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

Successfully merging this pull request may close these issues.

Add create constant raster
2 participants