Skip to content

Feature/offset scale outputs - #230

Open
doc78 wants to merge 36 commits into
developmentfrom
feature/offset_scale_outputs
Open

Feature/offset scale outputs#230
doc78 wants to merge 36 commits into
developmentfrom
feature/offset_scale_outputs

Conversation

@doc78

@doc78 doc78 commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

This PR adds the scale, offset and aggregation features

Comment thread src/lisflood/global_modules/netcdf.py
Comment thread src/lisflood/global_modules/default_options.py Outdated
Comment thread src/lisflood/global_modules/netcdf.py
nc_var = nf1.variables[self.map_name]
is_packed = nc_var.dtype == np.int16
if is_packed:
nc_var.set_auto_maskandscale(False)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We should double check the behavior of this line with the missing value. Maybe unit tests can help here to avoid issues

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes I fully agree, in our teams conversation I think you said you will take care right, but in any case if your schedule doesnt allow just let me know and I will start :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I already started it, don’t worry

Comment thread src/lisflood/global_modules/output.py Outdated
self._accum_count = 0
self._write_step = 0 # own step counter for NetCDF time dimension

# Disable int16 packing for aggregated outputs — scale/offset ranges

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Why? Scale and offset should be customizable, therefore we should still be able to set proper values. Furthermore, for mean aggregates there should be no issue of overflowing

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I agree, and the logic from teams makes totally sense to me! I might implement customization then now directly for the 5.1 release if u think it is not too much of a change in the xml etc.?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

XML will not change unless you need to specify different scale and offset for a specific variable

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.

2 participants