POST
|
I am looking to correct worldview 3 data to (hopefully) bottom of atmosphere/ground reflectance values and I came across the Apparent Reflectance function but it says it only supports WV1 and WV2. Is WV3 similar enough to WV2 that it should also work? If not is there another way around this?
Thanks!
... View more
10-29-2020
08:05 AM
|
0
|
1
|
785
|
POST
|
I have a python script that takes a folder full of multispectral worldview tifs and pansharpens them with their matching panchromatic band. Both these datasets have a background value of 0 but after I pansharpen it certain dates will have a background value of 1, which I do not want. I need the value to stay zero for other processes later on. Basically I am using the Gram-Schmidt method to pansharpen R, G B, NIR2 and then pansharpen the other four bands (RedEdge, Yellow, Coastal blue, NIR1) and then creating a composite to combine the two pansharpened outputs back into one raster. I do not want to use a mosaic dataset as these outputs are used later outside of ArcGIS. Here is the code I use: def pansharpening(multispec_list, pan_list):
# Pan sharpen each image individually
if len(multispec_list) != len(pan_list):
sys.exit("UNEVEN NUMBER OF PAN AND MULTI BANDS")
pansharp_list = []
for i in multispec_list:
# find the unique ID in the multispectral tif and match it to the pan band
multi = i
pan = multi.replace("M2AS", "P2AS")
if pan not in pan_list:
sys.exit("Missing matching pan bands to " + i)
# if the ID does not exist in the pan list the variable will be empty after that loop
pansharp_rgbn2 = os.path.splitext(multi)[0] + "_pansharpen_rgbn2.tif"
pansharp_recbyn1 = os.path.splitext(multi)[0] + "_pansharpen_recbyn1.tif"
comp_out = os.path.splitext(multi)[0] + "_pansharpen_allbands_0.tif"
comp_out_nodata = os.path.splitext(multi)[0] + "_pansharpen_allbands.tif"
# pansharpen R, G, B, NIR2 and CoastalB, RE, Y, NIR1 bands
print("pansharpening " + multi + " with " + pan + "and WorldView-3 inputs" )
arcpy.CreatePansharpenedRasterDataset_management(multi, 5, 3, 2, 8, pansharp_rgbn2, pan, "Gram-Schmidt", "", "", "", "", "WorldView-3")
print("pansharpened R,G,B,NIR2")
arcpy.CreatePansharpenedRasterDataset_management(multi, 6, 4, 1, 7, pansharp_recbyn1, pan, "Gram-Schmidt", "", "", "", "", "WorldView-3")
print("pansharpened CB,Y,RE,NIR1")
# create a composite with all 8 bands in the correct WV3 order
coastal = pansharp_recbyn1 + "\Band_3"
blue = pansharp_rgbn2 + "\Band_3"
green = pansharp_rgbn2 + "\Band_2"
yellow = pansharp_recbyn1 + "\Band_2"
red = pansharp_rgbn2 + "\Band_1"
rededge = pansharp_recbyn1 + "\Band_1"
nir1 = pansharp_recbyn1 + "\Band_4"
nir2 = pansharp_rgbn2 + "\Band_4"
print("creating composite")
arcpy.CompositeBands_management ([coastal,blue,green,yellow,red,rededge,nir1,nir2], comp_out)
# set nodata to 0
print("setting nodata to 0")
arcpy.CopyRaster_management(comp_out, comp_out_nodata, "", "", "0", "NONE", "NONE", "16_BIT_UNSIGNED", "NONE", "NONE")
pansharp_list.append(comp_out_nodata)
arcpy.Delete_management(pansharp_rgbn2)
arcpy.Delete_management(pansharp_recbyn1)
arcpy.Delete_management(comp_out) I can take the raster and reclassify the 0's to 1's later, but I want to avoid this from happening in the first place. As I'm not sure how to check in python if only the background value is 1s or 0s besides bringing it into ArcGIS Pro and visually looking at the background. (checking the whole raster for 1's in python may not work as I would expect there to be a value of 1 somewhere in the tif). Any idea why this is happening?
... View more
03-10-2020
08:09 AM
|
0
|
0
|
571
|
POST
|
Good points, thanks to both of you. I will have to share this with the person requesting the data and see how they want it!
... View more
03-05-2020
04:44 AM
|
0
|
0
|
1806
|
POST
|
I wouldn't say no reason to do it. If someone wants to work with one stacked raster instead of multiple individual tifs then it would decrease the amount of files delivered to them, so instead of 80 tifs they have 8. Was hoping there was a tool/setting I was missing so I could put it into my python script, but if not then I will look into the opensource libraries. Thanks!
... View more
03-04-2020
12:55 PM
|
0
|
2
|
1806
|
POST
|
Basically I want to stack some sentinel imagery so I have all the bands I want to use in one tif. But I want them to keep their native resolutions. For example, band 1 coastal blue is 60m and band 4 red is 10m. But when I stack all the bands using the composite bands tool it takes the first band and upsamples the rest of them to 60m/px to match. Any way to get around this?
... View more
03-04-2020
12:19 PM
|
0
|
4
|
1921
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|