Commit 24de2398 authored by geoint's avatar geoint

update

parent 08d8f93c
...@@ -32,12 +32,31 @@ def geoint_pr_ndvi(nir_fn, vir_fn, outfile): ...@@ -32,12 +32,31 @@ def geoint_pr_ndvi(nir_fn, vir_fn, outfile):
result = np.divide(numerator, denominator) result = np.divide(numerator, denominator)
driverJP2 = gdal.GetDriverByName('JP2OpenJPEG') driverJP2 = gdal.GetDriverByName('JP2OpenJPEG')
driverTiff = gdal.GetDriverByName('GTiff')
ndvi_int8 = np.multiply((result + 1), (2**7 - 1)) ndvi_int8 = np.multiply((result + 1), (2**7 - 1))
# output = driverTiff.Create(outfile, cols, rows, 1, gdal.GDT_Byte)
output = driverJP2.CreateCopy(outfile, nir, strict=0) output = driverJP2.CreateCopy(outfile, nir, strict=0)
raster = np.zeros((rows, cols), dtype=np.uint16)
output_band = output.GetRasterBand(1) output_band = output.GetRasterBand(1)
output_band.SetNoDataValue(-99) output_band.SetNoDataValue(-99)
output_band.WriteArray(ndvi_int8) output_band.WriteArray(raster)
#output.GetRasterBand(1).WriteArray(raster)
output.GetRasterBand(1).FlushCache()
output.GetRasterBand(1).WriteArray(raster)
output.FlushCache()
output = None
# output.SetGeoTransform(geotransform)
output_band = None
nir = None
#del output
#ndvi_int8)
def main(argv): def main(argv):
geoint_pr_ndvi(argv[1], argv[2], argv[3]) geoint_pr_ndvi(argv[1], argv[2], argv[3])
......
<PAMDataset>
<PAMRasterBand band="1">
<NoDataValue>-9.90000000000000E+01</NoDataValue>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="COMPRESSION">JPEG2000</MDI>
<MDI key="NBITS">15</MDI>
</Metadata>
</PAMRasterBand>
</PAMDataset>
...@@ -48,14 +48,14 @@ do ...@@ -48,14 +48,14 @@ do
fileout1=$(echo $filepattern | cut -d"_" -f1) fileout1=$(echo $filepattern | cut -d"_" -f1)
fileout2=$(echo $filepattern | cut -d"_" -f2) fileout2=$(echo $filepattern | cut -d"_" -f2)
python /home/geoint/git/GeoSentinel/geosentinel/ndvi.py $filepattern"04.jp2" $filepattern"08.jp2" ndvi/$fileout2"_"$fileout1".jpg" python /home/geoint/git/GeoSentinel/geosentinel/ndvi.py $NIR $VIR ndvi/$fileout2"_"$fileout1".jp2"
# convert $filepattern"04.jpg" $filepattern"03.jpg" $filepattern"02.jpg" -resize 640x480\! -combine video/$fileout2"_"$fileout1".jpg" # convert $filepattern"04.jpg" $filepattern"03.jpg" $filepattern"02.jpg" -resize 640x480\! -combine video/$fileout2"_"$fileout1".jpg"
if [ ! -d "video" ]; then if [ ! -d "video" ]; then
mkdir video mkdir video
fi fi
gdal_translate -projwin $3 -projwin_srs WGS84 -ot Byte -scale 0 4096 0 255 -of JPEG ndvi/$fileout2"_"$fileout1".jpg" video/$fileout2"_"$fileout1".jpg" # gdal_translate -projwin $3 -projwin_srs WGS84 -ot Byte -scale 0 4096 0 255 -of JPEG ndvi/$fileout2"_"$fileout1".jp2" video/$fileout2"_"$fileout1".jpg"
cd .. cd ..
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment