OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
cyan_alaska_tiles.py File Reference

Go to the source code of this file.

Namespaces

 cyan_alaska_tiles
 

Variables

 parser
 
 action
 
 version
 
 help
 
 args = parser.parse_args()
 
int nXtiles = 4
 
int nYtiles = 3
 
 sourcefile = args.ifile
 
 sourcefilebase = sourcefile.rstrip('.tif')
 
 srcDS = gdal.Open(sourcefile)
 
 T0 = Affine.from_gdal(*srcDS.GetGeoTransform())
 
 xy2rc = lambda xm, ym: (ym, xm) * ~T0
 
 xoff = int(xoff)
 
 yoff = int(yoff)
 
 endx = int(endx)
 
 endy = int(endy)
 
 xstride = int((endx-xoff)/nXtiles)
 
 ystride = int((endy-yoff)/nYtiles)
 
int ytile = y + 1
 
 uly = y * ystride + yoff
 
int xtile = x +1
 
 ulx = x * xstride + xoff
 
list srcwin = [ulx,uly,xstride,ystride]
 
string tileFile = sourcefilebase + '_' + str(xtile) + '_' + str(ytile) + '.tif'
 
 transop = gdal.TranslateOptions(creationOptions=['COMPRESS=LZW'],srcWin=srcwin)
 
 options