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

Nodata handling in 0c_Data_Preprocessing.ipynb #9

Open
dshean opened this issue Jan 4, 2025 · 0 comments
Open

Nodata handling in 0c_Data_Preprocessing.ipynb #9

dshean opened this issue Jan 4, 2025 · 0 comments

Comments

@dshean
Copy link
Member

dshean commented Jan 4, 2025

We need to do careful review of how nodata mask is prepared and used.

It's not clear to me that the original ASP DEM nodata is preserved, as the input ASP DEM defined in cell 2
initial_dsm_file = '20150911_2050_1020010042D39D00_1020010043455300_1.0m-DEM_trans_dx+2.40m_dy+1.51m_dz-0.36m__ASP_wt_avg_extrapolation_search_rad25_num_pass_3.tif'
Has already been filled. It seems the triangulation error is assumed to provide the "valid DEM pixel" mask. We need to verify that these are one-to-one in output from point2dem.

I don't understand this:

   # change nodata value from -9999 for triangulation error
    if key == 'triangulation_error':
        dst_raster = np.where(dst_raster==tmp_profile['nodata'], -1, dst_raster)
        tmp_profile.update({
            'nodata':-1
        })

This looping to create a common nodata mask for all input layers can likely be replaced by a simple multiplication if you have binary masks for a raster stack with identical dimensions. See my approach using masked arrays here: https://github.com/dshean/pygeotools/blob/master/pygeotools/lib/malib.py#L1307

nodata_mask = np.ones((1, nodata_mask_list[0].shape[0], nodata_mask_list[0].shape[1]), dtype=np.uint8)
for x in nodata_mask_list:
    nodata_mask = np.where(x==1, 0, nodata_mask)
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

1 participant