I have approximate coordinates of a box I need to work with the data, but I want the integer window in order to use the exact edge pixels. Using gdal_translate I get the box using projwin but I want to know the computed srcwin and use that instead.
How can I get it?
gdal_translate -projwin -3073414.9453 1649666.7710 -1749065.1524 2345626.7903 ../data/goes16.abi-2021.0206.1601-CMI-C03_1km.tif goes16.abi-2021.0206.1601-CMI-C03_1km.tif
Input file size is 5000, 3000
ERROR 1: buildCS: missing UNIT
0...10...20...30...40...50...60...70...80...90...100 - done.
The data info is
$ gdalinfo ../data/goes16.abi-2021.0206.1601-CMI-C03_1km.tif
Driver: GTiff/GeoTIFF
Files: ../data/goes16.abi-2021.0206.1601-CMI-C03_1km.tif
Size is 5000, 3000
ERROR 1: buildCS: missing UNIT
Origin = (-3627271.328111211769283,1583173.512170388596132)
Pixel Size = (1002.008657743770527,1002.008657743770527)
Corner Coordinates:
Upper Left (-3627271.328, 1583173.512)
Lower Left (-3627271.328, 4589199.485)
Upper Right ( 1382771.961, 1583173.512)
Lower Right ( 1382771.961, 4589199.485)
Center (-1122249.684, 3086186.499)
Band 1 Block=5000x1 Type=Float32, ColorInterp=Gray
NoData Value=-1
Metadata:
add_offset=0
ancillary_variables=DQF
cell_methods=t: point area: point
coordinates=band_id band_wavelength t y x
grid_mapping=goes_imager_projection
long_name=ABI L2+ Cloud and Moisture Imagery reflectance factor
NETCDF_VARNAME=CMI
resolution=y: 0.000028 rad x: 0.000028 rad
scale_factor=0.00031746001
sensor_band_bit_depth=10

--debug on. With some drivers the srcwindow is shown in the debug messages. – user30184 Feb 15 '21 at 21:31