Cumulus specific gdal utilities
GTiff Creation Options to be a COG: "-co", "COMPRESS=LZW", "-co", "COPY_SRC_OVERVIEWS=YES", "-co", "TILE=YES",
find_band(data_set, attr={})
Return the band number
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_set |
gdal.Dataset
|
gdal dataset |
required |
attr |
dict, optional
|
attributes matching those in the metadata, by default {} |
{}
|
Returns:
| Type | Description |
|---|---|
int
|
band number |
Source code in cumulus_packager/utils/cgdal.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
gdal_calculate(*args)
Implement gdal-utils gdal_calc CLI utility
gdal_translate documentation:
https://gdal.org/programs/gdal_translate.html
Source code in cumulus_packager/utils/cgdal.py
164 165 166 167 168 169 170 171 172 173 174 175 176 | |
gdal_fillnodataval(src, dst, /, *args)
Implement gdal-utils gdal_fillnodata CLI utility as a subprocess
gdal_fillnodata documentation:
https://gdal.org/programs/gdal_fillnodata.html
Source code in cumulus_packager/utils/cgdal.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
gdal_translate_options(**kwargs)
Return gdal translate options
Add dictionary attributes to use those options for translate
Adding an existing attribute in 'base' will overwright that option
Returns:
| Type | Description |
|---|---|
dict
|
dictionary of gdal translate options with base option(s) |
base = { "format": "COG", }
Source code in cumulus_packager/utils/cgdal.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | |
gdal_translate_w_overviews(dst, src, translate_options, resampling=None, overviewlist=[2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048])
Build overviews for the gdal dataset with the resampling algorithm provided
If no sampling algorithm is given, only gdal.Translate() executed
allowable resampling algorithms: nearest,average,rms,bilinear,gauss,cubic,cubicspline,lanczos,average_magphase,mode
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dst |
str
|
Output dataset name |
required |
src |
gdal.Dataset
|
Dataset object or a filename |
required |
translate_options |
dict
|
Dictionary of creation options |
required |
resampling |
str, optional
|
resampling algorithm, by default None |
None
|
overviewlist |
List[int], optional
|
list of integers, by default [2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048] |
[2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048]
|
Source code in cumulus_packager/utils/cgdal.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |