Skip to content

Fix wxModel NO_DATA warp collar#754

Merged
latwood merged 2 commits intomasterfrom
GUI-Redesign-fixWxModelNoData
Apr 4, 2026
Merged

Fix wxModel NO_DATA warp collar#754
latwood merged 2 commits intomasterfrom
GUI-Redesign-fixWxModelNoData

Conversation

@latwood
Copy link
Copy Markdown
Collaborator

@latwood latwood commented Apr 4, 2026

Fixes #647, at least for the wxModels. Seems the method actually applied to ALL warp types that use GDALWarpOptions, not just the specific GDALAutoCreateWarpedVRT() warping method.

So here and here in gdal_util.cpp still need checked (these functions seem to only be used by surface_fetch.cpp classes), all the various warps done in the various surface_fetch.cpp classes also need checked, and here, here, and here need checked in ascii_grid.cpp. But the wxModelInitialize.cpp classes SHOULD be good to go.

I believe the remaining surface_fetch.cpp warps in the code work correctly, because the DEM datasets actually HAVE pre-defined NO_DATA values, and if not and it is putting zeroes in for NO_DATA, we still clip the dataset to a subset area, clipping off the NO_DATA edges anyways. I believe the asciiToPng() output works out correctly, because NO_DATA values should already be defined for the dataset, and if not, then zeroes technically works out because the pixels are defined as 0 to 255 with NO_DATA values as 0 anyways.

I am a bit more leery of the raw value tiff output in ascii_grid.cpp though, here and here. NO_DATA values as zeroes probably works for the 'gtiff' datasets, but using the actual NO_DATA values would probably be better.

latwood added 2 commits April 3, 2026 16:49
…d datasets, removing the NO_DATA collars from the various wxModel datasets. For issue #647
…ue, printing the NO_DATA value was already skipped but the calculations were still being done unnecessarily.

I also noticed that the NO_DATA check in sampleRawOutput() was placed a bit late in the code, causing the log profile calculations results to replace the NO_DATA values with crazy high values, causing problems with the later stuff in the code. So I moved up that NO_DATA check to a better spot in the code, looks to be working better now. This check being earlier also allows wind_uv_to_sd() to no longer be dealing with NO_DATA values in that section of code.

I found these spots in the code as I was looking through all the various uses of the wrap0to360(), wind_uv_to_sd(), and wind_sd_to_uv() ninjaMathUtility functions, which are NOT meant to be used on NO_DATA values. I was worried that adding more correct NO_DATA values would cause those functions problems, but it looks like I had already gotten the proper logic done ("if(inVal == NO_DATA){outVal = NO_DATA;}else{outVal = wrap0to360(inVal);}") back when I did the angleFromNorth work, other than these two spots in the code. All the other spots in the code that didn't have this check, were good to go, because they used simulation or interpolated to inner region datasets, that were guaranteed to not have NO_DATA values by that point.

I almost added another check like this to ninja.cpp for the ascii grid output, but since that spot is simulation ascii output and not wxModel ascii output, it was still fine. Found the wxModel ascii output in wxModelInitialization.cpp, looks like wxModel ascii and shp file output are fine, they do not warp to a new projection, they stay in the original pre-warped projection, with the original band of NO_DATA values from the original pre-warp, all that was needed in that part of the code was to just print the values as they were.

For issue #647. Related to issue #544.
@latwood latwood added this to the 4.0.0 milestone Apr 4, 2026
@latwood latwood requested a review from masonwillman April 4, 2026 03:23
@latwood latwood self-assigned this Apr 4, 2026
@latwood latwood merged commit ab9aa13 into master Apr 4, 2026
6 checks passed
@latwood latwood deleted the GUI-Redesign-fixWxModelNoData branch April 4, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GDALAutoCreateWarpedVRT() on datasets without a defined NO_DATA value initializes grids to 0.0 instead of to chosen NO_DATA value

1 participant