Satellite Data Readers¶
This module provides specialized readers for various optical satellite missions. All these readers implement the GeoData protocol, which means they provide a consistent interface for spatial operations, data access, and manipulation.
These readers make it easy to work with official data formats from different Earth observation missions, and they can be used with all the functions available in the georeader.read
module.
Readers available:
Sentinel-2 Reader¶
The Sentinel-2 reader provides functionality for reading Sentinel-2 L1C and L2A products in SAFE format. It supports:
- Direct reading from local files or cloud storage (Google Cloud Storage)
- Windowed reading for efficient memory usage
- Conversion from digital numbers to radiance
- Access to metadata, including viewing geometry and solar angles
Tutorial examples:
- Reading from the public Google bucket
- Exploring image metadata
- Creating mosaics from multiple images
- Converting TOA reflectance to radiance
API Reference¶
Sentinel-2 reader inherited from https://github.com/IPL-UV/DL-L8S2-UV.
Authors: Gonzalo Mateo-García, Dan Lopez-Puigdollers
It has several enhancements:
- Support for S2L2A images
- It can read directly images from a GCP bucket (for example data from here)
- Windowed read and read and reproject in the same function (see
load_bands_bbox
) - Creation of the image only involves reading one metadata file (
xxx.SAFE/MTD_{self.producttype}.xml
) - Compatible with
georeader.read
functions - It can read from the pyramid if available.
S2Image
¶
Base Sentinel-2 image reader for handling Sentinel-2 satellite products. Do Not use this class directly, use S2ImageL1C or S2ImageL2A instead.
This class provides functionality to read and manipulate Sentinel-2 satellite imagery. It handles the specific format and metadata of Sentinel-2 products, supporting operations like loading bands, masks, and converting digital numbers to radiance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s2folder
|
str
|
Path to the Sentinel-2 SAFE product folder. |
required |
polygon
|
Optional[Polygon]
|
Polygon defining the area of interest in EPSG:4326. Defaults to None (entire image). |
None
|
granules
|
Optional[Dict[str, str]]
|
Dictionary mapping band names to file paths. Defaults to None (automatically discovered). |
None
|
out_res
|
int
|
Output resolution in meters. Must be one of 10, 20, or 60. Defaults to 10. |
10
|
window_focus
|
Optional[Window]
|
Window to focus on a specific region of the image. Defaults to None (entire image). |
None
|
bands
|
Optional[List[str]]
|
List of bands to read. If None, all available bands will be loaded based on the product type. |
None
|
metadata_msi
|
Optional[str]
|
Path to metadata file. If None, it is assumed to be in the SAFE folder. |
None
|
Attributes:
Name | Type | Description |
---|---|---|
mission |
str
|
Mission identifier (e.g., 'S2A', 'S2B'). |
producttype |
str
|
Product type identifier (e.g., 'MSIL1C', 'MSIL2A'). |
pdgs |
str
|
PDGS Processing Baseline number. |
relorbitnum |
str
|
Relative Orbit number. |
tile_number_field |
str
|
Tile Number field. |
product_discriminator |
str
|
Product Discriminator. |
name |
str
|
Base name of the product. |
folder |
str
|
Path to the product folder. |
datetime |
datetime
|
Acquisition datetime. |
metadata_msi |
str
|
Path to the MSI metadata file. |
out_res |
int
|
Output resolution in meters. |
bands |
List[str]
|
List of bands to read. |
dims |
Tuple[str]
|
Names of the dimensions ("band", "y", "x"). |
fill_value_default |
int
|
Default fill value (typically 0). |
band_check |
str
|
Band used as template for reading. |
granule_readers |
Dict[str, RasterioReader]
|
Dictionary of readers for each band. |
window_focus |
Window
|
Current window focus. |
transform |
Affine transform for the window. |
|
crs |
Coordinate reference system. |
|
shape |
Shape of the data (bands, height, width). |
|
bounds |
Bounds of the window. |
|
res |
Tuple[float, float]
|
Resolution of the data. |
Source code in georeader/readers/S2_SAFE_reader.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 |
|
__init__(s2folder, polygon=None, granules=None, out_res=10, window_focus=None, bands=None, metadata_msi=None)
¶
Sentinel-2 image reader class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s2folder
|
str
|
name of the SAFE product expects name |
required |
polygon
|
Optional[Polygon]
|
in CRS EPSG:4326 |
None
|
granules
|
Optional[Dict[str, str]]
|
dictionary with granule name and path |
None
|
out_res
|
int
|
output resolution in meters one of 10, 20, 60 (default 10) |
10
|
window_focus
|
Optional[Window]
|
rasterio window to read. All reads will be based on this window |
None
|
bands
|
Optional[List[str]]
|
list of bands to read. If None all bands are read. |
None
|
metadata_msi
|
Optional[str]
|
path to metadata file. If None it is assumed to be in the SAFE folder |
None
|
Source code in georeader/readers/S2_SAFE_reader.py
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
cache_product_to_local_dir(path_dest=None, print_progress=True, format_bands=None)
¶
Copy the product to a local directory and return a new instance of the class with the new path
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path_dest
|
Optional[str]
|
path to the destination folder. If None, the current folder ()".") is used |
None
|
print_progress
|
bool
|
print progress bar. Default True |
True
|
format_bands
|
Optional[str]
|
format of the bands. Default None (keep original format). Options: "COG", "GeoTIFF" |
None
|
Returns:
Type | Description |
---|---|
__class__
|
A new instance of the class pointing to the new path |
Source code in georeader/readers/S2_SAFE_reader.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
|
get_reader(band_names, overview_level=None)
¶
Provides a RasterioReader object to read all the bands at the same resolution
Parameters:
Name | Type | Description | Default |
---|---|---|---|
band_names
|
Union[str, List[str]]
|
List of band names or band. raises assertion error if bands have different resolution. |
required |
overview_level
|
Optional[int]
|
level of the pyramid to read (same as in rasterio) |
None
|
Returns:
Type | Description |
---|---|
RasterioReader
|
RasterioReader |
Source code in georeader/readers/S2_SAFE_reader.py
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
|
quantification_value()
¶
Returns the quantification value stored in the metadata msi file (this is always: 10_000)
Source code in georeader/readers/S2_SAFE_reader.py
536 537 538 539 540 541 542 543 544 |
|
read_from_band_names(band_names)
¶
Read from band names
Parameters:
Name | Type | Description | Default |
---|---|---|---|
band_names
|
List[str]
|
List of band names |
required |
Returns:
Type | Description |
---|---|
__class__
|
Copy of current object with band names set to band_names |
Source code in georeader/readers/S2_SAFE_reader.py
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 |
|
solar_irradiance()
¶
Returns solar irradiance per nanometer: W/m²/nm
Source code in georeader/readers/S2_SAFE_reader.py
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
|
S2ImageL1C
¶
Bases: S2Image
Sentinel-2 Level 1C (top of atmosphere reflectance) image reader.
This class extends the base S2Image class to handle Sentinel-2 Level 1C products, which provide calibrated and orthorectified top of atmosphere reflectance data. It also provides methods to access viewing and solar angle information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s2folder
|
str
|
Path to the Sentinel-2 SAFE product folder. |
required |
granules
|
Dict[str, str]
|
Dictionary mapping band names to file paths. |
required |
polygon
|
Polygon
|
Polygon defining the area of interest in EPSG:4326. |
required |
out_res
|
int
|
Output resolution in meters. Must be one of 10, 20, or 60. Defaults to 10. |
10
|
window_focus
|
Optional[Window]
|
Window to focus on a specific region of the image. Defaults to None (entire image). |
None
|
bands
|
Optional[List[str]]
|
List of bands to read. If None, all available bands will be loaded. |
None
|
metadata_msi
|
Optional[str]
|
Path to metadata file. If None, it is assumed to be in the SAFE folder. |
None
|
Attributes:
Name | Type | Description |
---|---|---|
Additional |
to S2Image attributes
|
|
granule_folder |
str
|
Path to the granule folder. |
msk_clouds_file |
str
|
Path to the cloud mask file. |
metadata_tl |
str
|
Path to the TL metadata file. |
root_metadata_tl |
Root element of the TL metadata XML. |
|
tileId |
str
|
Tile identifier. |
satId |
str
|
Satellite identifier. |
procLevel |
str
|
Processing level. |
dimsByRes |
Dict
|
Dimensions by resolution. |
ulxyByRes |
Dict
|
Upper-left coordinates by resolution. |
tileAnglesNode |
Dict
|
Tile angles node from metadata. |
mean_sza |
float
|
Mean solar zenith angle. |
mean_saa |
float
|
Mean solar azimuth angle. |
mean_vza |
Dict[str, float]
|
Mean viewing zenith angle per band. |
mean_vaa |
Dict[str, float]
|
Mean viewing azimuth angle per band. |
vaa |
Dict[str, GeoTensor]
|
Viewing azimuth angle as GeoTensor per band. |
vza |
Dict[str, GeoTensor]
|
Viewing zenith angle as GeoTensor per band. |
saa |
GeoTensor
|
Solar azimuth angle as GeoTensor. |
sza |
GeoTensor
|
Solar zenith angle as GeoTensor. |
anglesULXY |
Tuple[float, float]
|
Upper-left coordinates of the angle grids. |
Examples:
>>> # Initialize the S2ImageL1C reader with a data path
>>> s2_l1c = S2ImageL1C('/path/to/S2A_MSIL1C_20170717T235959_N0205_R072_T01WCP_20170718T000256.SAFE',
... granules=granules_dict, polygon=aoi_polygon)
>>> # Load all bands
>>> l1c_data = s2_l1c.load()
>>> # Read angle information
>>> s2_l1c.read_metadata_tl()
>>> solar_zenith = s2_l1c.sza
>>> # Convert to radiance
>>> radiance_data = s2_l1c.DN_to_radiance()
Source code in georeader/readers/S2_SAFE_reader.py
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 |
|
cache_product_to_local_dir(path_dest=None, print_progress=True, format_bands=None)
¶
Overrides the parent method to copy the MTD_TL.xml file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path_dest
|
Optional[str]
|
path to the destination folder. Defaults to None. |
None
|
print_progress
|
bool
|
whether to print progress. Defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
__class__ |
__class__
|
the cached object |
Source code in georeader/readers/S2_SAFE_reader.py
996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 |
|
read_metadata_tl()
¶
Read metadata TILE to parse information about the acquisition and properties of GRANULE bands.
It populates the following attributes
- mean_sza
- mean_saa
- mean_vza
- mean_vaa
- vaa
- vza
- saa
- sza
- anglesULXY
- tileId
- satId
- procLevel
- epsg_code
- dimsByRes
- ulxyByRes
- tileAnglesNode
- root_metadata_tl
Source code in georeader/readers/S2_SAFE_reader.py
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 |
|
S2ImageL2A
¶
Bases: S2Image
Sentinel-2 Level 2A (surface reflectance) image reader.
This class extends the base S2Image class to handle Sentinel-2 Level 2A products, which provide surface reflectance data with atmospheric corrections applied.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s2folder
|
str
|
Path to the Sentinel-2 SAFE product folder. |
required |
granules
|
Dict[str, str]
|
Dictionary mapping band names to file paths. |
required |
polygon
|
Polygon
|
Polygon defining the area of interest in EPSG:4326. |
required |
out_res
|
int
|
Output resolution in meters. Must be one of 10, 20, or 60. Defaults to 10. |
10
|
window_focus
|
Optional[Window]
|
Window to focus on a specific region of the image. Defaults to None (entire image). |
None
|
bands
|
Optional[List[str]]
|
List of bands to read. If None, the default L2A bands (excluding B10) will be loaded. |
None
|
metadata_msi
|
Optional[str]
|
Path to metadata file. If None, it is assumed to be in the SAFE folder. |
None
|
Attributes:
Name | Type | Description |
---|---|---|
mission |
str
|
Mission identifier (e.g., 'S2A', 'S2B'). |
producttype |
str
|
Product type identifier (e.g., 'MSIL2A'). |
pdgs |
str
|
PDGS Processing Baseline number. |
relorbitnum |
str
|
Relative Orbit number. |
tile_number_field |
str
|
Tile Number field. |
product_discriminator |
str
|
Product Discriminator. |
name |
str
|
Base name of the product. |
folder |
str
|
Path to the product folder. |
datetime |
datetime
|
Acquisition datetime. |
metadata_msi |
str
|
Path to the MSI metadata file. |
out_res |
int
|
Output resolution in meters. |
bands |
List[str]
|
List of bands to read. |
dims |
Tuple[str]
|
Names of the dimensions ("band", "y", "x"). |
fill_value_default |
int
|
Default fill value (typically 0). |
band_check |
str
|
Band used as template for reading. |
granule_readers |
Dict[str, RasterioReader]
|
Dictionary of readers for each band. |
window_focus |
Window
|
Current window focus. |
Examples:
>>> # Initialize the S2ImageL2A reader with a data path
>>> s2_l2a = S2ImageL2A('/path/to/S2A_MSIL2A_20170717T235959_N0205_R072_T01WCP_20170718T000256.SAFE',
... granules=granules_dict, polygon=aoi_polygon)
>>> # Load all bands
>>> l2a_data = s2_l2a.load()
Source code in georeader/readers/S2_SAFE_reader.py
789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 |
|
s2loader(s2folder, out_res=10, bands=None, window_focus=None, granules=None, polygon=None, metadata_msi=None)
¶
Loads a S2ImageL2A or S2ImageL1C depending on the product type
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s2folder
|
str
|
.SAFE folder. Expected standard ESA naming convention (see s2_name_split fun) |
required |
out_res
|
int
|
default output resolution {10, 20, 60} |
10
|
bands
|
Optional[List[str]]
|
Bands to read. Default to BANDS_S2 or BANDS_S2_L2A depending on the product type |
None
|
window_focus
|
Optional[Window]
|
window to read when creating the object |
None
|
granules
|
Optional[Dict[str, str]]
|
Dict where keys are the band names and values are paths to the band location |
None
|
polygon
|
Optional[Polygon]
|
polygon with the footprint of the object |
None
|
metadata_msi
|
Optional[str]
|
path to metadata file |
None
|
Returns:
Type | Description |
---|---|
Union[S2ImageL2A, S2ImageL1C]
|
S2Image reader |
Source code in georeader/readers/S2_SAFE_reader.py
1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 |
|
s2_public_bucket_path(s2file, check_exists=False, mode='gcp')
¶
Returns the expected patch in the public bucket of the S2 file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s2file
|
str
|
safe file (e.g. S2B_MSIL1C_20220527T030539_N0400_R075_T49SGV_20220527T051042.SAFE) |
required |
check_exists
|
bool
|
check if the file exists in the bucket, This will not work if GOOGLE_APPLICATION_CREDENTIALS and/or GS_USER_PROJECT env variables are not set. Default to False |
False
|
mode
|
str
|
"gcp" or "rest" |
'gcp'
|
Returns:
Type | Description |
---|---|
str
|
full path to the file (e.g. gs://gcp-public-data-sentinel-2/tiles/49/S/GV/S2B_MSIL1C_20220527T030539_N0400_R075_T49SGV_20220527T051042.SAFE) |
Source code in georeader/readers/S2_SAFE_reader.py
1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 |
|
read_srf(satellite, srf_file=SRF_FILE_DEFAULT, cache=True)
¶
Process the spectral response function file. If the file is not provided it downloads it from https://sentinel.esa.int/web/sentinel/user-guides/sentinel-2-msi/document-library/-/asset_publisher/Wk0TKajiISaR/content/sentinel-2a-spectral-responses
This function requires the fsspec package and pandas and openpyxl for reading excel files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
satellite
|
str
|
satellite name (S2A, S2B or S2C) |
required |
srf_file
|
str
|
path to the srf file |
SRF_FILE_DEFAULT
|
cache
|
bool
|
if True, the srf is cached for future calls. Default True |
True
|
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: spectral response function for each of the bands of S2 |
Source code in georeader/readers/S2_SAFE_reader.py
1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 |
|
Proba-V Reader¶
The Proba-V reader enables access to Proba-V Level 2A and Level 3 products. It handles:
- Reading TOA reflectance from HDF5 files
- Mask handling for clouds, shadows, and invalid pixels
- Extraction of metadata and acquisition parameters
Tutorial example:
API Reference¶
Proba-V reader
Unnoficial Proba-V reader. This reader is based in the Proba-V user manual: https://publications.vito.be/2017-1333-probav-products-user-manual.pdf
Author: Gonzalo Mateo-García
ProbaV
¶
Proba-V reader for handling Proba-V satellite products.
This class provides functionality to read and manipulate Proba-V satellite imagery products. It handles the specific format and metadata of Proba-V HDF5 files, supporting operations like loading radiometry data, masks, and cloud information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hdf5_file
|
str
|
Path to the HDF5 file containing the Proba-V product. |
required |
window
|
Optional[Window]
|
Optional window to focus on a specific region of the image. Defaults to None (entire image). |
None
|
level_name
|
str
|
Processing level of the product, either "LEVEL2A" or "LEVEL3". Defaults to "LEVEL3". |
'LEVEL3'
|
Attributes:
Name | Type | Description |
---|---|---|
hdf5_file |
str
|
Path to the HDF5 file. |
name |
str
|
Basename of the HDF5 file. |
camera |
str
|
Camera ID (for LEVEL2A products). |
res_name |
str
|
Resolution name identifier (e.g., '100M', '300M', '1KM'). |
version |
str
|
Product version. |
toatoc |
str
|
Indicator of whether data is TOA (top of atmosphere) or TOC (top of canopy). |
real_transform |
Affine
|
Affine transform for the full image. |
real_shape |
Tuple[int, int]
|
Shape of the full image (height, width). |
dtype_radiometry |
Data type for radiometry data (typically np.float32). |
|
dtype_sm |
Data type for SM (status map) data. |
|
metadata |
Dict[str, Any]
|
Dictionary with product metadata. |
window_focus |
Window
|
Current window focus. |
window_data |
Window
|
Window representing the full data extent. |
start_date |
datetime
|
Start acquisition date and time. |
end_date |
datetime
|
End acquisition date and time. |
map_projection_wkt |
str
|
WKT representation of the map projection. |
crs |
Coordinate reference system. |
|
level_name |
str
|
Processing level identifier. |
Examples:
>>> import rasterio.windows
>>> # Initialize the ProbaV reader with a data path
>>> probav_reader = ProbaV('/path/to/probav_product.HDF5')
>>> # Load radiometry data
>>> bands = probav_reader.load_radiometry()
>>> # Get cloud mask
>>> cloud_mask = probav_reader.load_sm_cloud_mask()
>>> # Focus on a specific window
>>> window = rasterio.windows.Window(col_off=100, row_off=100, width=200, height=200)
>>> probav_reader.set_window(window)
Source code in georeader/readers/probav_image_operational.py
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 123 124 125 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
|
load_mask(boundless=True)
¶
Returns the valid mask (False if the pixel is out of swath or is invalid). This function loads the SM band
Parameters:
Name | Type | Description | Default |
---|---|---|---|
boundless
|
bool
|
boundless option to load the SM band. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
GeoTensor
|
geotensor.GeoTensor: mask with the same shape as the image |
Source code in georeader/readers/probav_image_operational.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
|
load_sm(boundless=True)
¶
Reference of values in SM
flags.
From user manual pag 67
* Clear -> 000
* Shadow -> 001
* Undefined -> 010
* Cloud -> 011
* Ice -> 100
* 2**3
sea/land
* 2**4
quality swir (0 bad 1 good)
* 2**5
quality nir
* 2**6
quality red
* 2**7
quality blue
* 2**8
coverage swir (0 no 1 yes)
* 2**9
coverage nir
* 2**10
coverage red
* 2**11
coverage blue
Source code in georeader/readers/probav_image_operational.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
|
save_bands(img)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
img
|
ndarray
|
(4, self.real_height, self.real_width, 4) tensor |
required |
Returns:
Source code in georeader/readers/probav_image_operational.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
|
ProbaVRadiometry
¶
Bases: ProbaV
A specialized ProbaV reader class focused on radiometry data.
This class extends the base ProbaV class to provide a simplified interface for working with radiometry bands from Proba-V products.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hdf5_file
|
str
|
Path to the HDF5 file containing the Proba-V product. |
required |
window
|
Optional[Window]
|
Optional window to focus on a specific region of the image. Defaults to None (entire image). |
None
|
level_name
|
str
|
Processing level of the product. Defaults to "LEVEL2A". |
'LEVEL2A'
|
indexes
|
Optional[List[int]]
|
Optional list of band indices to load. If None, all four bands (0=BLUE, 1=RED, 2=NIR, 3=SWIR) will be loaded. Defaults to None. |
None
|
Attributes:
Name | Type | Description |
---|---|---|
dims |
Tuple[str]
|
Names of the dimensions ("band", "y", "x"). |
indexes |
List[int]
|
List of band indices to load. |
dtype |
Data type of the radiometry data. |
|
count |
int
|
Number of bands to be loaded. |
shape |
Tuple[int, int, int]
|
Shape of the data (bands, height, width). |
values |
ndarray
|
The radiometry data values. |
Examples:
>>> # Initialize the ProbaVRadiometry reader with a data path
>>> probav_rad = ProbaVRadiometry('/path/to/probav_product.HDF5')
>>> # Load only RED and NIR bands
>>> probav_rad_rn = ProbaVRadiometry('/path/to/probav_product.HDF5', indexes=[1, 2])
>>> # Get the data as a GeoTensor
>>> geotensor_data = probav_rad.load()
Source code in georeader/readers/probav_image_operational.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
|
ProbaVSM
¶
Bases: ProbaV
A specialized ProbaV reader class focused on Status Map (SM) data.
This class extends the base ProbaV class to provide a simplified interface for working with the status map band from Proba-V products. The SM band contains information about the pixel quality, cloud status, etc.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hdf5_file
|
str
|
Path to the HDF5 file containing the Proba-V product. |
required |
window
|
Optional[Window]
|
Optional window to focus on a specific region of the image. Defaults to None (entire image). |
None
|
level_name
|
str
|
Processing level of the product. Defaults to "LEVEL2A". |
'LEVEL2A'
|
Attributes:
Name | Type | Description |
---|---|---|
dims |
Tuple[str]
|
Names of the dimensions ("y", "x"). |
dtype |
Data type of the SM data. |
|
shape |
Tuple[int, int]
|
Shape of the SM data (height, width). |
values |
ndarray
|
The SM data values. |
Examples:
>>> # Initialize the ProbaVSM reader with a data path
>>> probav_sm = ProbaVSM('/path/to/probav_product.HDF5')
>>> # Get the SM data as a GeoTensor
>>> sm_data = probav_sm.load()
>>> # Extract cloud information
>>> cloud_mask = sm_cloud_mask(sm_data.values)
Source code in georeader/readers/probav_image_operational.py
590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
|
SPOT-VGT Reader¶
The SPOT-VGT reader provides functionality for reading SPOT-VGT products. Features include:
- HDF4 file format support
- Handling of radiometry and quality layers
- Cloud and shadow mask extraction
Note: See the Proba-V tutorial for similar processing workflows as both sensors share similar data structures.
API Reference¶
SPOT VGT reader
Unofficial reader for SPOT VGT products. The reader is based on the user manual: https://docs.terrascope.be/DataProducts/SPOT-VGT/references/SPOT_VGT_PUM_v1.3.pdf
Authors: Dan Lopez-Puigdollers, Gonzalo Mateo-García
SpotVGT
¶
SPOT-VGT reader for handling SPOT Vegetation satellite products.
This class provides functionality to read and manipulate SPOT-VGT satellite imagery products. It handles the specific format and metadata of SPOT-VGT HDF4 files, supporting operations like loading radiometry data, masks, and cloud information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hdf4_file
|
str
|
Path to the HDF4 file or directory containing the SPOT-VGT product. |
required |
window
|
Optional[Window]
|
Optional window to focus on a specific region of the image. Defaults to None (entire image). |
None
|
Attributes:
Name | Type | Description |
---|---|---|
hdf4_file |
str
|
Path to the HDF4 file. |
name |
str
|
Basename of the HDF4 file. |
satelliteID |
str
|
Satellite ID extracted from the filename. |
station |
str
|
Station code extracted from the filename. |
productID |
str
|
Product ID extracted from the filename. |
year, |
month, day (str
|
Date components extracted from the filename. |
segment |
str
|
Segment identifier extracted from the filename. |
version |
str
|
Product version extracted from the filename. |
files |
List[str]
|
List of files in the SPOT-VGT product. |
files_dict |
Dict[str, str]
|
Dictionary mapping band names to file paths. |
metadata |
Dict[str, str]
|
Metadata extracted from the LOG file. |
real_shape |
Tuple[int, int]
|
Shape of the full image (height, width). |
real_transform |
Affine
|
Affine transform for the full image. |
dtype_radiometry |
Data type for radiometry data (typically np.float32). |
|
window_focus |
Window
|
Current window focus. |
window_data |
Window
|
Window representing the full data extent. |
start_date |
datetime
|
Start acquisition date and time. |
end_date |
datetime
|
End acquisition date and time. |
crs |
Coordinate reference system. |
|
toatoc |
str
|
Indicator of whether data is TOA (top of atmosphere). |
res_name |
str
|
Resolution name identifier (e.g., '1KM'). |
level_name |
str
|
Processing level identifier. |
Examples:
>>> import rasterio.windows
>>> # Initialize the SpotVGT reader with a data path
>>> spot_reader = SpotVGT('/path/to/V2KRNP____20140321F146_V003')
>>> # Load radiometry data
>>> bands = spot_reader.load_radiometry()
>>> # Get cloud mask
>>> cloud_mask = spot_reader.load_sm_cloud_mask()
>>> # Focus on a specific window
>>> window = rasterio.windows.Window(col_off=100, row_off=100, width=200, height=200)
>>> spot_reader.set_window(window)
Source code in georeader/readers/spotvgt_image_operational.py
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 123 124 125 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
|
load_mask(boundless=True)
¶
Returns the valid mask (False if the pixel is out of swath or is invalid). This function loads the SM band
Parameters:
Name | Type | Description | Default |
---|---|---|---|
boundless
|
bool
|
boundless option to load the SM band. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
GeoTensor
|
geotensor.GeoTensor: mask with the same shape as the image |
Source code in georeader/readers/spotvgt_image_operational.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
|
load_sm(boundless=True)
¶
Reference of values in SM
flags.
From user manual pag 46
* Clear -> 000
* Shadow -> 001
* Undefined -> 010
* Cloud -> 011
* Ice -> 100
* 2**3
sea/land
* 2**4
quality swir (0 bad 1 good)
* 2**5
quality nir
* 2**6
quality red
* 2**7
quality blue
Source code in georeader/readers/spotvgt_image_operational.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
|
PRISMA Reader¶
The PRISMA reader handles data from the Italian Space Agency's hyperspectral mission, specifically working with Level 1B radiance data (not atmospherically corrected). PRISMA provides hyperspectral imaging in the 400-2500 nm spectral range, with a spectral resolution of ~12 nm.
Key features:
- Reading L1B hyperspectral radiance data from HDF5 format files
- Handling separate VNIR (400-1000 nm) and SWIR (1000-2500 nm) spectral ranges
- Georeferencing functionality for non-orthorectified data using provided latitude/longitude coordinates
- On-demand conversion from radiance (mW/m²/sr/nm) to top-of-atmosphere reflectance
- Spectral response function integration for accurate band simulation
- Extraction of RGB previews from specific wavelengths
- Access to satellite and solar geometry information for radiometric calculations
Tutorial examples:
API Reference¶
PRISMA
¶
PRISMA (PRecursore IperSpettrale della Missione Applicativa) image reader.
This class provides functionality to read and manipulate PRISMA satellite imagery products. It handles the specific format and metadata of PRISMA HDF5 files, supporting operations like loading specific wavelengths, RGB composites, and converting to reflectance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
Path to the PRISMA HDF5 file. |
required |
Attributes:
Name | Type | Description |
---|---|---|
filename |
str
|
Path to the PRISMA file. |
swir_cube_dat |
str
|
Path to SWIR cube data in HDF5 file. |
vni_cube_dat |
str
|
Path to VNIR cube data in HDF5 file. |
lats |
ndarray
|
Latitude values for each pixel. |
lons |
ndarray
|
Longitude values for each pixel. |
attributes_prisma |
Dict
|
Dictionary of PRISMA metadata attributes. |
nbands_vnir |
int
|
Number of VNIR bands. |
vnir_range |
Tuple[float, float]
|
Wavelength range of VNIR bands (min, max). |
nbands_swir |
int
|
Number of SWIR bands. |
swir_range |
Tuple[float, float]
|
Wavelength range of SWIR bands (min, max). |
ltoa_swir |
Optional[NDArray]
|
SWIR radiance data, lazily loaded. |
ltoa_vnir |
Optional[NDArray]
|
VNIR radiance data, lazily loaded. |
wavelength_swir |
Optional[NDArray]
|
SWIR wavelengths, lazily loaded. |
fwhm_swir |
Optional[NDArray]
|
SWIR FWHM (Full Width at Half Maximum), lazily loaded. |
wavelength_vnir |
Optional[NDArray]
|
VNIR wavelengths, lazily loaded. |
fwhm_vnir |
Optional[NDArray]
|
VNIR FWHM, lazily loaded. |
vza_swir |
float
|
Viewing zenith angle for SWIR. |
vza_vnir |
float
|
Viewing zenith angle for VNIR. |
sza_swir |
float
|
Solar zenith angle for SWIR. |
sza_vnir |
float
|
Solar zenith angle for VNIR. |
time_coverage_start |
datetime
|
Start time of acquisition. |
time_coverage_end |
datetime
|
End time of acquisition. |
units |
str
|
Units of radiance data (mW/m2/sr/nm). |
Examples:
>>> # Initialize the PRISMA reader with a data path
>>> prisma = PRISMA('/path/to/prisma_file.he5')
>>> # Load RGB bands
>>> rgb = prisma.load_rgb(as_reflectance=True)
>>> # Load specific wavelengths
>>> bands = prisma.load_wavelengths([850, 1600, 2200], as_reflectance=True)
>>> # Get image metadata
>>> print(prisma)
Source code in georeader/readers/prisma.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 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 123 124 125 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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
|
load_raw(swir_flag)
¶
Load the all the data from all the wavelengths for the VNIR or SWIR range.
This function caches the data, wavelegths and FWHM in the attributes of the class:
* ltoa_swir
, wavelength_swir
, fwhm_swir
, vza_swir
, sza_swir
if swir_flag
is True
* ltoa_vnir
, wavelength_vnir
, fwhm_vnir
, vza_vnir
, sza_vnir
if swir_flag
is False
Parameters:
Name | Type | Description | Default |
---|---|---|---|
swir_flag
|
bool
|
if True it will load the SWIR range, otherwise it will load the VNIR range |
required |
Returns:
Name | Type | Description |
---|---|---|
NDArray |
NDArray
|
3D array with the reflectance values (H, W, B) where N and M are the dimensions of the image and B is the number of bands. |
Source code in georeader/readers/prisma.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
load_wavelengths(wavelengths, as_reflectance=True, raw=True, resolution_dst=30, dst_crs=None, fill_value_default=-1)
¶
Load the reflectance of the given wavelengths
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wavelengths
|
Union[float, List[float], NDArray]
|
List of wavelengths to load |
required |
as_reflectance
|
bool
|
return the values as reflectance rather than radiance. Defaults to True.
If False values will have units of W/m^2/SR/um ( |
True
|
raw
|
bool
|
if True it will return the raw values, if False it will return the values reprojected to the specified CRS and resolution. Defaults to True. |
True
|
resolution_dst
|
int
|
if raw is False, it will reproject the values to this resolution. Defaults to 30. |
30
|
dst_crs
|
Optional[Any]
|
if None it will use the corresponding UTM zone. |
None
|
fill_value_default
|
float
|
fill value. Defaults to -1. |
-1
|
Returns:
Type | Description |
---|---|
Union[GeoTensor, NDArray]
|
Union[GeoTensor, NDArray]: if raw is True it will return a NDArray with the values, otherwise it will return a GeoTensor
with the reprojected values in its |
Source code in georeader/readers/prisma.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
|
EMIT Reader¶
The EMIT (Earth Surface Mineral Dust Source Investigation) reader provides access to NASA's imaging spectrometer data from the International Space Station. This reader works with Level 1B calibrated radiance data (not atmospherically corrected).
Key features:
- Reading L1B hyperspectral radiance data from NetCDF4 format files
- Working with the 380-2500 nm spectral range with 7.4 nm sampling
- Irregular grid georeferencing through GLT (Geographic Lookup Table)
- Support for the observation geometry information (solar and viewing angles)
- Integration with L2A mask products for cloud and shadow detection
- Quality-aware analysis with cloud, cirrus, and spacecraft flag masks
- Conversion from radiance (μW/cm²/sr/nm) to top-of-atmosphere reflectance
- Support for downloading data from NASA DAAC portals
- Automatic detection and use of appropriate UTM projection
Tutorial example:
API Reference¶
Module to read EMIT images.
Requires: netCDF4: pip install netCDF4
Some of the functions of this module are based on the official EMIT repo: https://github.com/emit-sds/emit-utils/
EMITImage
¶
Class to read L1B EMIT (Earth Surface Mineral Dust Source Investigation) images.
This class provides functionality to read and manipulate EMIT satellite imagery products. It handles the specific format and metadata of EMIT HDF files, supporting operations like loading radiometry data, masks, and viewing/solar angles.
This class incorporates features from the official EMIT utilities: https://github.com/emit-sds/emit-utils/
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
Path to the EMIT .nc file. |
required |
glt
|
Optional[GeoTensor]
|
Optional pre-loaded GLT (Geographic Lookup Table). If None, it will be loaded from the file. Defaults to None. |
None
|
band_selection
|
Optional[Union[int, Tuple[int, ...], slice]]
|
Optional band selection. Defaults to slice(None) (all bands). |
slice(None)
|
Attributes:
Name | Type | Description |
---|---|---|
filename |
str
|
Path to the EMIT file. |
nc_ds |
Dataset
|
netCDF4 dataset for the EMIT file. |
_nc_ds_obs |
Optional[Dataset]
|
netCDF4 dataset for observation data. |
_nc_ds_l2amask |
Optional[Dataset]
|
netCDF4 dataset for L2A mask. |
real_transform |
Affine
|
Affine transform for the image. |
time_coverage_start |
datetime
|
Start time of the acquisition. |
time_coverage_end |
datetime
|
End time of the acquisition. |
dtype |
Data type of the radiometry data. |
|
dims |
Tuple[str]
|
Names of dimensions ("band", "y", "x"). |
fill_value_default |
Default fill value. |
|
nodata |
No data value. |
|
units |
str
|
Units of the radiometry data. |
glt |
GeoTensor
|
Geographic Lookup Table as a GeoTensor. |
valid_glt |
ndarray
|
Boolean mask of valid GLT values. |
glt_relative |
GeoTensor
|
Relative Geographic Lookup Table. |
window_raw |
Window
|
Window for raw data. |
bandname_dimension |
str
|
Dimension name for bands. |
band_selection |
Current band selection. |
|
wavelengths |
ndarray
|
Wavelengths of the selected bands. |
fwhm |
ndarray
|
Full Width at Half Maximum for each band. |
Examples:
>>> from georeader.readers.emit import EMITImage, download_product
>>> link = 'https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-protected/EMITL1BRAD.001/EMIT_L1B_RAD_001_20220828T051941_2224004_006/EMIT_L1B_RAD_001_20220827T060753_2223904_013.nc'
>>> filepath = download_product(link)
>>> emit = EMITImage(filepath)
>>> # Reproject to UTM
>>> crs_utm = georeader.get_utm_epsg(emit.footprint("EPSG:4326"))
>>> emit_utm = emit.to_crs(crs_utm)
>>> # Load as reflectance
>>> reflectance = emit_utm.load(as_reflectance=True)
>>> # Get cloud mask
>>> cloud_mask = emit.nc_ds_l2amask
Source code in georeader/readers/emit.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 |
|
mask_bands: np.array
property
¶
Returns the mask bands -> ['Cloud flag', 'Cirrus flag', 'Water flag', 'Spacecraft Flag', 'Dilated Cloud Flag', 'AOD550', 'H2O (g cm-2)', 'Aggregate Flag']
mean_sza: float
property
¶
Return the mean solar zenith angle
mean_vza: float
property
¶
Return the mean view zenith angle
nc_ds_l2amask: netCDF4.Dataset
property
¶
Loads the L2A mask file. In this file we have information about the cloud mask.
This function downloads the L2A mask file if it does not exist from the JPL portal.
It caches the L2A mask file in the object. (self.nc_ds_l2amask)
See https://lpdaac.usgs.gov/products/emitl2arflv001/ for info about the L2A mask file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
l2amaskfile
|
Optional[str]
|
Path to the L2A mask file. Defaults to None. If none it will download the L2A mask file from the EMIT server. |
required |
nc_ds_obs: netCDF4.Dataset
property
¶
Loads the observation file. In this file we have information about angles (solar and viewing), elevation and ilumination based on elevation and path length.
This function downloads the observation file if it does not exist from the JPL portal.
It caches the observation file in the object. (self.nc_ds_obs)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obs_file
|
Optional[str]
|
Path to the observation file. Defaults to None. If none it will download the observation file from the EMIT server. |
required |
observation_bands: np.array
property
¶
Returns the observation bands
percentage_clear: float
property
¶
Return the percentage of clear pixels in the image
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
percentage of clear pixels |
shape_raw: Tuple[int, int, int]
property
¶
Return the shape of the raw data in (C, H, W) format
footprint(crs=None)
¶
Get the footprint of the image in the given CRS. If no CRS is given, the footprint is returned in the native CRS. This function takes into account the valid_glt mask to compute the footprint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
crs
|
Optional[str]
|
The CRS to return the footprint in. Defaults to None. If None, the footprint is returned in the native CRS. |
None
|
Returns:
Name | Type | Description |
---|---|---|
Polygon |
Polygon
|
The footprint of the image in the given CRS. |
Source code in georeader/readers/emit.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
|
georreference(data, fill_value_default=None)
¶
Georreference an image in sensor coordinates to coordinates of the current georreferenced object. If you do some processing with the raw data, you can georreference the raw output with this function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
array
|
raw data (C, H, W) or (H, W). |
required |
Returns:
Name | Type | Description |
---|---|---|
GeoTensor |
GeoTensor
|
georreferenced version of data (C, H', W') or (H', W') |
Example
emit_image = EMITImage("path/to/emit_image.nc") emit_image_rgb = emit_image.read_from_bands([35, 23, 11]) data_rgb = emit_image_rgb.load_raw() # (3, H, W) data_rgb_ortho = emit_image.georreference(data_rgb) # (3, H', W')
Source code in georeader/readers/emit.py
759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 |
|
invalid_mask_raw(with_buffer=True)
¶
Returns the non georreferenced quality mask. True means that the pixel is not valid.
This mask is computed as the sum of the Cloud flag, Cirrus flag, Spacecraft flag and Dilated Cloud Flag. True means that the pixel is not valid.
From: https://github.com/nasa/EMIT-Data-Resources/blob/main/python/how-tos/How_to_use_EMIT_Quality_data.ipynb and https://github.com/nasa/EMIT-Data-Resources/blob/main/python/modules/emit_tools.py#L277
Source code in georeader/readers/emit.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
|
load_raw(transpose=True)
¶
Load the raw data, without orthorectification
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transpose
|
bool
|
Transpose the data if it has 3 dimentsions to (C, H, W) Defaults to True. if False return (H, W, C) |
True
|
Returns:
Type | Description |
---|---|
array
|
np.array: raw data (C, H, W) or (H, W) |
Source code in georeader/readers/emit.py
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 |
|
mask(mask_name='cloud_mask')
¶
Return the mask layer with the given name. Mask shall be one of self.mask_bands -> ['Cloud flag', 'Cirrus flag', 'Water flag', 'Spacecraft Flag', 'Dilated Cloud Flag', 'AOD550', 'H2O (g cm-2)', 'Aggregate Flag']
Args: mask_name (str, optional): Name of the mask. Defaults to "cloud_mask".
Returns: GeoTensor: mask
Source code in georeader/readers/emit.py
576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
|
observation(name)
¶
Returns the observation with the given name
Source code in georeader/readers/emit.py
604 605 606 607 608 609 610 |
|
set_band_selection(band_selection=None)
¶
Set the band selection. Band selection is absolute w.r.t self.nc_ds['radiance']
Parameters:
Name | Type | Description | Default |
---|---|---|---|
band_selection
|
Optional[Union[int, Tuple[int, ...], slice]]
|
slicing or selection of the bands. Defaults to None. |
None
|
Example
emit_image.set_band_selection(slice(0, 3)) # will only load the three first bands emit_image.wavelengths # will only return the wavelengths of the three first bands emit_image.load() # will only load the three first bands
Source code in georeader/readers/emit.py
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
|
sza()
¶
Return the solar zenith angle as a GeoTensor
Source code in georeader/readers/emit.py
612 613 614 |
|
to_crs(crs='UTM', resolution_dst_crs=60)
¶
Reproject the image to a new crs
Parameters:
Name | Type | Description | Default |
---|---|---|---|
crs
|
Any
|
CRS. |
'UTM'
|
Returns:
Name | Type | Description |
---|---|---|
EmitImage |
__class__
|
EMIT image in the new CRS |
Example
emit_image = EMITImage("path/to/emit_image.nc") emit_image_utm = emit_image.to_crs(crs="UTM")
Source code in georeader/readers/emit.py
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 |
|
validmask(with_buffer=True)
¶
Return the validmask mask
Returns:
Name | Type | Description |
---|---|---|
GeoTensor |
GeoTensor
|
bool mask. True means that the pixel is valid. |
Source code in georeader/readers/emit.py
527 528 529 530 531 532 533 534 535 536 537 538 539 |
|
vza()
¶
Return the view zenith angle as a GeoTensor
Source code in georeader/readers/emit.py
616 617 618 |
|
water_mask()
¶
Returns the water mask
Source code in georeader/readers/emit.py
594 595 596 |
|
download_product(link_down, filename=None, display_progress_bar=True, auth=None)
¶
Download a product from the EMIT website (https://search.earthdata.nasa.gov/search). It requires that you have an account in the NASA Earthdata portal.
This code is based on this example: https://git.earthdata.nasa.gov/projects/LPDUR/repos/daac_data_download_python/browse
Parameters:
Name | Type | Description | Default |
---|---|---|---|
link_down
|
str
|
link to the product |
required |
filename
|
Optional[str]
|
filename to save the product |
None
|
display_progress_bar
|
bool
|
display tqdm progress bar |
True
|
auth
|
Optional[Tuple[str, str]]
|
tuple with user and password to download the product. If None, it will try to read the user and password from ~/.georeader/auth_emit.json |
None
|
Example
link_down = 'https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-protected/EMITL1BRAD.001/EMIT_L1B_RAD_001_20220828T051941_2224004_006/EMIT_L1B_RAD_001_20220828T051941_2224004_006.nc' filename = download_product(link_down)
Source code in georeader/readers/emit.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
get_radiance_link(product_path)
¶
Get the link to download a product from the EMIT website. See: https://git.earthdata.nasa.gov/projects/LPDUR/repos/daac_data_download_python/browse
Parameters:
Name | Type | Description | Default |
---|---|---|---|
product_path
|
str
|
path to the product or filename of the product or product name with or without extension. e.g. 'EMIT_L1B_RAD_001_20220827T060753_2223904_013.nc' |
required |
Example
product_path = 'EMIT_L1B_RAD_001_20220827T060753_2223904_013.nc' link = get_radiance_link(product_path) 'https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-protected/EMITL1BRAD.001/EMIT_L1B_RAD_001_20220827T060753_2223904_013/EMIT_L1B_RAD_001_20220827T060753_2223904_013.nc'
Source code in georeader/readers/emit.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
get_obs_link(product_path)
¶
Get the link to download a product from the EMIT website. See: https://git.earthdata.nasa.gov/projects/LPDUR/repos/daac_data_download_python/browse
Parameters:
Name | Type | Description | Default |
---|---|---|---|
product_path
|
str
|
path to the product or filename of the product with or without extension. e.g. 'EMIT_L1B_RAD_001_20220827T060753_2223904_013.nc' |
required |
Example
product_path = 'EMIT_L1B_RAD_001_20220827T060753_2223904_013.nc' link = get_radiance_link(product_path) 'https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-protected/EMITL1BRAD.001/EMIT_L1B_RAD_001_20220827T060753_2223904_013/EMIT_L1B_OBS_001_20220827T060753_2223904_013.nc'
Source code in georeader/readers/emit.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
|
get_ch4enhancement_link(tile)
¶
Get the link to download a product from the EMIT website. See: https://git.earthdata.nasa.gov/projects/LPDUR/repos/daac_data_download_python/browse
Parameters:
Name | Type | Description | Default |
---|---|---|---|
product_path
|
path to the product or filename of the product with or without extension. e.g. 'EMIT_L1B_RAD_001_20220827T060753_2223904_013.nc' |
required |
Example
product_path = 'EMIT_L1B_RAD_001_20220827T060753_2223904_013.nc' link = get_radiance_link(product_path) 'https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-protected/EMITL2BCH4ENH.001/EMIT_L2B_CH4ENH_001_20220810T064957_2222205_033/EMIT_L2B_CH4ENH_001_20220810T064957_2222205_033.tif'
Source code in georeader/readers/emit.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
get_l2amask_link(tile)
¶
Get the link to download a product from the EMIT website (https://search.earthdata.nasa.gov/search)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tile
|
str
|
path to the product or filename of the L1B product with or without extension. e.g. 'EMIT_L1B_RAD_001_20220827T060753_2223904_013.nc' |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
link to the L2A mask product |
Example
tile = 'EMIT_L1B_RAD_001_20220827T060753_2223904_013.nc' link = get_l2amask_link(tile) 'https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-protected/EMITL2ARFL.001/EMIT_L2A_RFL_001_20220827T060753_2223904_013/EMIT_L2A_MASK_001_20220827T060753_2223904_013.nc'
Source code in georeader/readers/emit.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
|
valid_mask(filename, with_buffer=False, dst_crs='UTM', resolution_dst_crs=60)
¶
Loads the valid mask from the EMIT L2AMASK file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
str
|
path to the L2AMASK file. e.g. EMIT_L2A_MASK_001_20220827T060753_2223904_013.nc |
required |
with_buffer
|
bool
|
If True, the buffer band is used to compute the valid mask. Defaults to False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
GeoTensor |
Tuple[GeoTensor, float]
|
valid mask |
Source code in georeader/readers/emit.py
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 |
|
EnMAP Reader¶
The EnMAP (Environmental Mapping and Analysis Program) reader processes data from the German hyperspectral satellite mission. This reader works with Level 1B radiometrically calibrated data (not atmospherically corrected) that contains radiance values in physical units.
Key features:
- Reading L1B hyperspectral radiance data from GeoTIFF format with accompanying XML metadata
- Working with separate VNIR (420-1000 nm) and SWIR (900-2450 nm) spectral ranges
- Support for 228 spectral channels with 6.5 nm (VNIR) and 10 nm (SWIR) sampling
- Integration with Rational Polynomial Coefficients (RPCs) for accurate geometric correction
- Conversion from radiance (mW/m²/sr/nm) to top-of-atmosphere reflectance
- Access to solar illumination and viewing geometry for radiometric calculations
- Support for quality masks
Tutorial example:
API Reference¶
EnMAP
¶
EnMAP (Environmental Mapping and Analysis Program) image reader.
This class provides functionality to read and manipulate EnMAP satellite imagery products. It handles the specific format and metadata of EnMAP files, supporting operations like loading specific wavelengths, RGB composites, and converting to reflectance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
xml_file
|
str
|
Path to the EnMAP XML metadata file. |
required |
by_folder
|
bool
|
If True, files are organized by folder structure. Defaults to False. |
False
|
window_focus
|
Optional[Window]
|
Window to focus on a specific region of the image. Defaults to None (entire image). |
None
|
fs
|
Optional[AbstractFileSystem]
|
Filesystem to use for file access. Defaults to None (local filesystem). |
None
|
Attributes:
Name | Type | Description |
---|---|---|
xml_file |
str
|
Path to the XML metadata file. |
by_folder |
bool
|
Whether files are organized by folder structure. |
swir_file |
str
|
Path to the SWIR image file. |
fs |
AbstractFileSystem
|
Filesystem used for file access. |
swir |
RasterioReader
|
Reader for SWIR image. |
vnir |
RasterioReader
|
Reader for VNIR image. |
wl_center |
Dict
|
Dictionary of center wavelengths for each band. |
wl_fwhm |
Dict
|
Dictionary of FWHM (Full Width at Half Maximum) for each band. |
hsf |
float
|
Mean ground elevation. |
sza |
float
|
Solar zenith angle. |
saa |
float
|
Solar azimuth angle. |
vaa |
float
|
Viewing azimuth angle. |
vza |
float
|
Viewing zenith angle. |
gain_arr |
Dict
|
Dictionary of gain values for each band. |
offs_arr |
Dict
|
Dictionary of offset values for each band. |
rpcs_vnir |
Dict
|
Rational Polynomial Coefficients for VNIR. |
rpcs_swir |
Dict
|
Rational Polynomial Coefficients for SWIR. |
swir_range |
Tuple[float, float]
|
Wavelength range of SWIR bands. |
vnir_range |
Tuple[float, float]
|
Wavelength range of VNIR bands. |
units |
str
|
Units of radiance data (mW/m2/sr/nm). |
time_coverage_start |
datetime
|
Start time of acquisition. |
time_coverage_end |
datetime
|
End time of acquisition. |
Examples:
>>> # Initialize the EnMAP reader with a data path
>>> enmap = EnMAP('/path/to/enmap_metadata.xml')
>>> # Load RGB bands as reflectance with RPCs applied
>>> rgb = enmap.load_rgb(as_reflectance=True, apply_rpcs=True)
>>> # Load specific wavelengths
>>> bands = enmap.load_wavelengths([850, 1600, 2200], as_reflectance=True)
>>> # Load cloud mask or other quality products
>>> clouds = enmap.load_product('QL_QUALITY_CLOUD')
Source code in georeader/readers/enmap.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 |
|
load_rgb(as_reflectance=True, apply_rpcs=True, dst_crs='EPSG:4326', resolution_dst_crs=None)
¶
Load RGB image from VNIR bands. Converts radiance to TOA reflectance if as_reflectance is True
otherwise it will return the radiance values in W/m^2/SR/um == mW/m2/sr/nm (self.units
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
as_reflectance
|
bool
|
Convert radiance to TOA reflectance. Defaults to True. |
True
|
apply_rpcs
|
bool
|
Apply RPCs to the image. Defaults to True. |
True
|
dst_crs
|
str
|
Destination CRS. Defaults to "EPSG:4326". |
'EPSG:4326'
|
resolution_dst_crs
|
Optional[Union[float, Tuple[float, float]]]
|
Resolution of the destination CRS. Defaults to None. |
None
|
Returns: GeoTensor: with the RGB image
Source code in georeader/readers/enmap.py
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 |
|
load_wavelengths(wavelengths, as_reflectance=True)
¶
Load the reflectance of the given wavelengths
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wavelengths
|
Union[float, List[float], NDArray]
|
List of wavelengths to load |
required |
as_reflectance
|
bool
|
return the values as reflectance rather than radiance.
Defaults to True. If False values will have units of W/m^2/SR/um == mW/m2/sr/nm ( |
True
|
Returns:
Type | Description |
---|---|
Union[GeoTensor, NDArray]
|
Union[GeoTensor, NDArray]: GeoTensor with the values in reflectance or radiance units. |
Raises:
Type | Description |
---|---|
ValueError
|
If any wavelength is outside the sensor's range. |
Source code in georeader/readers/enmap.py
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
|