Add raster to mosaic dataset doesn't display correct values but no error

667
5
12-10-2020 10:32 AM
SidonieHorn
New Contributor

I am trying to create a mosaic dataset using clipped Hansen tree cover data. I have a script that extracts each raster to my desired extent. However, I want to make all my separate rasters into one raster. The individual raster look correct (values 0-19) and AddRastersToMosaicDataset runs without giving me any errors. However, my output appears to be empty and displays the values 0-255. I'm not sure how to fix this and would appreciate any tips.

Here is the last chunk of code. 

# Add rasters to Mosiaic dataset:

fgd_dir = in_raster_folder
fgd_name = "test_data.gdb"
fgd_path = os.path.join(fgd_dir, fgd_name)

fgd_ds = os.path.join(fgd_path, "mosaicds")


arcpy.AddRastersToMosaicDataset_management(
in_mosaic_dataset = fgd_ds,
raster_type = "Raster Dataset",
input_path = out_raster_folder,
sub_folder = "NO_SUBFOLDERS",
duplicate_items_action = "OVERWRITE_DUPLICATES"
)

 

0 Kudos
5 Replies
DavidPike
MVP Frequent Contributor

I would throw in a Calculate Statistics.

0 Kudos
SidonieHorn
New Contributor

That didn't seem to make a difference. 

0 Kudos
DavidPike
MVP Frequent Contributor

What do the Min and Max PS sizes look like?  What file types are in the Raster folder, and is there possibly a mixture of filetypes?

If you export Mosaic Dataset Paths do they look correct? And possibly try the operation manually on a subset of data to test.

0 Kudos
KeXu
by Esri Contributor
Esri Contributor

I met with the similar problem. Use GP tool Calculate Statistics on MDS, then get the right result. As you said, that didn't seem to make difference. Please try to set Strech type to Percent Clip.

0 Kudos
aallegretti
New Contributor

Build Pyramids and Statistics on the MDS

0 Kudos