API reference#
earthcarekit.read
File reading utilities.
Notes#
This module depends on other internal modules:
- earthcarekit.constants
- earthcarekit.data
- earthcarekit.filter
- earthcarekit.geo
- earthcarekit.stats
- earthcarekit.typing
- earthcarekit.utils
FileAgency
#
Bases: FileInfoEnum
Source code in earthcarekit/read/info/agency.py
from_input
classmethod
#
from_input(input: str | Dataset) -> FileAgency
Infers the EarthCARE product agency (i.e. ESA or JAXA) from a given file or dataset.
Source code in earthcarekit/read/info/agency.py
FileLatency
#
Bases: FileInfoEnum
Source code in earthcarekit/read/info/latency.py
from_input
classmethod
#
from_input(input: str | Dataset) -> FileLatency
Infers the EarthCARE product latency indicator (i.e. N for Near-real time, O for Offline, X for not applicable) from a given name, file or dataset.
Source code in earthcarekit/read/info/latency.py
FileType
#
Bases: FileInfoEnum
Source code in earthcarekit/read/info/type.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 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 | |
from_input
classmethod
#
from_input(input: PathLike | Dataset) -> FileType
Infers the EarthCARE product type from a given file or dataset.
Source code in earthcarekit/read/info/type.py
LazyDataset
dataclass
#
Lightweight EarthCARE data container with xarray.Dataset-like interface.
Partially mimics xarray.Dataset for faster variable access (e.g., ds["x"], ds.dims, ds["x"].values).
Variables load lazily upon first access within a with block.
Attributes:
| Name | Type | Description |
|---|---|---|
filepath |
str | HTTPFile
|
Path to HDF5/NetCDF-4 file or |
trim_to_frame |
bool
|
Trim to latitude frame bounds if True. |
in_memory |
bool
|
Load variables eagerly if True; otherwise lazily. |
to_geoid |
bool
|
Convert height/altitude from HAE (WGS84) to AMSL (EGM96) if True. |
vars |
str | Iterable[str] | None
|
Variable names to load at init; all loaded if |
origin |
Literal['native', 'derived'] | None
|
Product origin ("native", "derived", or None for auto-detect). |
logger |
Logger
|
Logger for debug messages; defaults to root logger. |
Examples:
Source code in earthcarekit/read/lazy/_dataset.py
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 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 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | |
nadir_index
property
#
Index of the across-track nadir pixel or None if not applicable.
variables
property
#
Names of variables available for access.
Returns a list of variable names. If the underlying file is still open, the list includes both already loaded variables and variables that can be loaded lazily. Otherwise, only loaded variables are included.
get
#
Retrieves a variables by name.
Variables are returned under the following conditions:
- If the variable is already loaded.
- If not loaded but a generator exists for the given
var, generates the variable first. - Otherwise, attempts to load the variable from the underlying dataset file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
var
|
str
|
Name of the variable to retrieve. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
LazyVariable |
LazyVariable
|
The requested variable. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If |
Source code in earthcarekit/read/lazy/_dataset.py
ProductInfo
dataclass
#
Stores metadata extracted from an EarthCARE product's file path.
Attributes:
| Name | Type | Description |
|---|---|---|
mission_id |
FileMissionID
|
Mission ID (ECA = EarthCARE). |
agency |
FileAgency
|
Agency (E = ESA, J = JAXA). |
latency |
FileLatency
|
Latency (X = N/A, N = NRT, O = offline). |
baseline |
str
|
Two-letter processor version (e.g., "BA"). |
file_type |
FileType
|
Full product name (e.g., "ATL_EBD_2A"). |
start_sensing_time |
Timestamp
|
Time of first data in product. |
start_processing_time |
Timestamp
|
Time processing started. |
orbit_number |
int
|
Orbit number. |
frame_id |
str
|
Frame ID (A-H; night/day/polar). |
orbit_and_frame |
str
|
Orbit+frame string (e.g., "01234F"). |
filename |
str
|
Product filename without extension. |
filepath |
str
|
Local file path or empty string. |
hdr_filepath |
str
|
Local header file path or empty string. |
start_latitude |
float
|
Track start latitude [deg N]. |
start_longitude |
float
|
Track start longitude [deg E]. |
end_latitude |
float
|
Track end latitude [deg N]. |
end_longitude |
float
|
Track end longitude [deg E]. |
url_download_h5 |
str | None
|
Download URL for HDF5 file. |
url_download_hdr |
str | None
|
Download URL for header file. |
url_quicklook |
str | None
|
Download URL for quicklook image. |
Source code in earthcarekit/read/info/product_info.py
to_dataframe
#
add_depol_ratio
#
add_depol_ratio(
ds_anom: Dataset,
rolling_w: int = 20,
near_zero_tolerance: float = 2e-07,
smooth: bool = True,
skip_height_above_elevation: int = 300,
cpol_var: str = "mie_attenuated_backscatter",
xpol_var: str = "crosspolar_attenuated_backscatter",
elevation_var: str = ELEVATION_VAR,
height_var: str = HEIGHT_VAR,
height_dim: str = VERTICAL_DIM,
) -> Dataset
Computes depolarization ratio (DPOL = XPOL/CPOL) from attenuated backscatter signals.
Applies surface masking, rolling mean smoothing, and near-zero tolerance handling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds_anom
|
Dataset
|
ATL_NOM_1B dataset with cross- and co-polar attenuated backscatter. |
required |
rolling_w
|
int
|
Rolling mean window size; defaults to 20. |
20
|
near_zero_tolerance
|
float
|
Threshold for masking near-zero |
2e-07
|
smooth
|
bool
|
Apply rolling mean smoothing if True. |
True
|
skip_height_above_elevation
|
int
|
Vertical margin above surface to mask in meters; defaults to 300. |
300
|
cpol_var
|
str
|
Co-polar variable name; defaults to "mie_attenuated_backscatter". |
'mie_attenuated_backscatter'
|
xpol_var
|
str
|
Cross-polar variable name; defaults to "crosspolar_attenuated_backscatter". |
'crosspolar_attenuated_backscatter'
|
elevation_var
|
str
|
Elevation variable name. |
ELEVATION_VAR
|
height_var
|
str
|
Height variable name. |
HEIGHT_VAR
|
height_dim
|
str
|
Height dimension name. |
VERTICAL_DIM
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Dataset with depolarization ratio, cleaned signals, and ratio profile added. |
Source code in earthcarekit/read/product/level1/atl_nom_1b.py
add_isccp_cloud_type
#
add_isccp_cloud_type(
ds: Dataset,
new_var: str = "isccp_cloud_type",
cot_var: str = "cloud_optical_thickness",
cth_var: str = "cloud_top_height",
along_track_dim: str = ALONG_TRACK_DIM,
across_track_dim: str = ACROSS_TRACK_DIM,
) -> Dataset
Adds ISCCP cloud type classification to the dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
MSI_COP_2A dataset with COT and CTH. |
required |
new_var
|
str
|
Name of the ISCCP cloud type variable; defaults to "isccp_cloud_type". |
'isccp_cloud_type'
|
cot_var
|
str
|
Cloud optical thickness variable name; defaults to "cloud_optical_thickness". |
'cloud_optical_thickness'
|
cth_var
|
str
|
Cloud top height variable name; defaults to "cloud_top_height". |
'cloud_top_height'
|
along_track_dim
|
str
|
Along-track dimension name. |
ALONG_TRACK_DIM
|
across_track_dim
|
str
|
Across-track dimension name. |
ACROSS_TRACK_DIM
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Dataset with ISCCP cloud type variable added. |
References
- International Satellite Cloud Climatology Project (ISCCP). ISCCP Definition of Cloud Types. Retrieved September 25, 2025. https://isccp.giss.nasa.gov/cloudtypes.html
Source code in earthcarekit/read/product/level2a/msi_cop_2a.py
add_potential_temperature
#
add_potential_temperature(
ds: Dataset,
temperature_var: str = "temperature_kelvin",
pressure_var: str = "pressure",
new_var: str = "potential_temperature",
) -> Dataset
Computes potential temperature from temperature [K] and pressure [Pa].
Adds potential temperature (in K and °C) as new variables to the dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
Dataset containing temperature [K] and pressure [Pa]. |
required |
temperature_var
|
str
|
Input temperature variable name; defaults to "temperature_kelvin". |
'temperature_kelvin'
|
pressure_var
|
str
|
Input pressure variable name; defaults to "pressure". |
'pressure'
|
new_var
|
str
|
New variable name for potential temperature in K; defaults to "potential_temperature". |
'potential_temperature'
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Dataset with potential temperature (K and °C) added as new variables. |
Source code in earthcarekit/read/product/auxiliary/aux_met_1d.py
add_scattering_ratio
#
add_scattering_ratio(
ds_anom: Dataset,
formula: Literal["x/c", "(c+x)/r", "(c+x+r)/r"],
rolling_w: int = 20,
near_zero_tolerance: float = 2e-07,
smooth: bool = True,
skip_height_above_elevation: int = 300,
cpol_var: str = "mie_attenuated_backscatter",
xpol_var: str = "crosspolar_attenuated_backscatter",
ray_var: str = "rayleigh_attenuated_backscatter",
elevation_var: str = ELEVATION_VAR,
height_var: str = HEIGHT_VAR,
height_dim: str = VERTICAL_DIM,
) -> Dataset
Computes scattering ratio from attenuated backscatter signals.
Applies surface masking, rolling mean smoothing, and near-zero tolerance handling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds_anom
|
Dataset
|
ATL_NOM_1B dataset with attenuated backscatter signals. |
required |
formula
|
Literal['x/c', '(c+x)/r', '(c+x+r)/r']
|
Scattering ratio formula ("x/c", "(c+x)/r", or "(c+x+r)/r"). |
required |
rolling_w
|
int
|
Rolling mean window size; defaults to 20. |
20
|
near_zero_tolerance
|
float
|
Threshold for masking near-zero denominators; defaults to 2e-7. |
2e-07
|
smooth
|
bool
|
Apply rolling mean smoothing if True. |
True
|
skip_height_above_elevation
|
int
|
Vertical margin above surface to mask in meters; defaults to 300. |
300
|
cpol_var
|
str
|
Co-polar variable name; defaults to "mie_attenuated_backscatter". |
'mie_attenuated_backscatter'
|
xpol_var
|
str
|
Cross-polar variable name; defaults to "crosspolar_attenuated_backscatter". |
'crosspolar_attenuated_backscatter'
|
ray_var
|
str
|
Rayleigh variable name; defaults to "rayleigh_attenuated_backscatter". |
'rayleigh_attenuated_backscatter'
|
elevation_var
|
str
|
Elevation variable name. |
ELEVATION_VAR
|
height_var
|
str
|
Height variable name. |
HEIGHT_VAR
|
height_dim
|
str
|
Height dimension name. |
VERTICAL_DIM
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Dataset with scattering ratio curtain and profile added. |
Source code in earthcarekit/read/product/level1/atl_nom_1b.py
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 | |
get_product_info
#
get_product_info(
filepath: str, warn: bool = False, must_exist: bool = True, read_geo_from_hdr: bool = False
) -> ProductInfo
Gather all info contained in the EarthCARE product's file path.
Source code in earthcarekit/read/info/product_info.py
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 | |
get_product_infos
#
get_product_infos(
filepaths: str | list[str] | NDArray | DataFrame | Dataset,
warn: bool = False,
must_exist: bool = True,
read_geo_from_hdr: bool = False,
) -> ProductDataFrame
Extracts product metadata from EarthCARE file paths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepaths
|
str | list[str] | NDArray | DataFrame | Dataset
|
File paths (str, list, array), DataFrame with "filepath" column, or Dataset with "source" encoding. |
required |
warn
|
bool
|
Emit warnings for missing/invalid files if True. |
False
|
must_exist
|
bool
|
Raise error if files don't exist if True. |
True
|
read_geo_from_hdr
|
bool
|
Extract geo-coordinates from header if True. |
False
|
Returns:
| Type | Description |
|---|---|
ProductDataFrame
|
A |
Source code in earthcarekit/read/info/product_info.py
read_any
#
Reads various input types and returns an xarray.Dataset.
This function can read
- EarthCARE product files (
.h5) - NetCDF files (
.nc) - Manually processed PollyXT output files (
.txt)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
str | Dataset
|
File path or existing Dataset. |
required |
**kwargs
|
Additional keyword arguments for specific readers. |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset
|
The opened dataset. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the file type is not supported. |
TypeError
|
If the input type is invalid. |
Source code in earthcarekit/read/any.py
read_header_data
#
Opens the product header groups of a EarthCARE file as a xarray.Dataset.
Source code in earthcarekit/read/header.py
read_nc
#
Returns an xarray.Dataset from a Dataset or NetCDF file path, optionally loaded into memory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
str | Dataset
|
Path to a NetCDF file. If a already opened |
required |
modify
|
bool
|
If True, default modifications to the opened dataset will be applied (e.g., converting heights in Polly data from height a.g.l. to height above mean sea level). |
True
|
in_memory
|
bool
|
If True, ensures the dataset is fully loaded into memory. Defaults to False. |
False
|
**kwargs
|
Key-word arguments passed to |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset
|
The resulting dataset. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If input is not a Dataset or string. |
Source code in earthcarekit/read/netcdf.py
read_polly
#
Reads manually processed PollyXT output text files as xarray.Dataset or returns an already open one.
Source code in earthcarekit/read/pollynet.py
read_product
#
read_product(
input: PathLike | Dataset,
trim_to_frame: bool = True,
modify: bool = DEFAULT_READ_EC_PRODUCT_MODIFY,
header: bool = DEFAULT_READ_EC_PRODUCT_HEADER,
meta: bool = DEFAULT_READ_EC_PRODUCT_META,
ensure_nans: bool = DEFAULT_READ_EC_PRODUCT_ENSURE_NANS,
in_memory: bool = False,
to_geoid: bool = False,
origin: Literal["native", "derived"] | None = None,
try_lazy: bool = True,
**kwargs
) -> Dataset
Returns an xarray.Dataset from a file path or existing dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
PathLike | Dataset
|
File path or |
required |
trim_to_frame
|
bool
|
Trim to latitude frame bounds if True. |
True
|
modify
|
bool
|
Apply default modifications (e.g., dimension renaming) if True. |
DEFAULT_READ_EC_PRODUCT_MODIFY
|
header
|
bool
|
Include header data if True. |
DEFAULT_READ_EC_PRODUCT_HEADER
|
meta
|
bool
|
Include metadata (e.g., orbit/frame) from header if True. |
DEFAULT_READ_EC_PRODUCT_META
|
ensure_nans
|
bool
|
Convert _FillValues to NaNs even if encoding is missing. |
DEFAULT_READ_EC_PRODUCT_ENSURE_NANS
|
in_memory
|
bool
|
Load dataset fully into memory if True. |
False
|
to_geoid
|
bool
|
Convert height/altitude from HAE (WGS84) to AMSL (EGM96) if True. |
False
|
origin
|
Literal['native', 'derived'] | None
|
Product origin ("native", "derived", or None for auto-detect). |
None
|
try_lazy
|
bool
|
Use |
True
|
**kwargs
|
Passed to underlying reader ( |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset
|
An |
Raises:
| Type | Description |
|---|---|
TypeError
|
If input is not a Dataset or string. |
Source code in earthcarekit/read/product/_generic.py
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 | |
read_products
#
read_products(
filepaths: Sequence[str] | NDArray[str_] | DataFrame,
zoom_at: float | None = None,
along_track_dim: str = ALONG_TRACK_DIM,
func: Callable | None = None,
func_inputs: Sequence[dict] | None = None,
max_num_files: int = 8,
coarsen: bool = True,
) -> Dataset
Read and concatenate EarthCARE frames into a single xarray Dataset.
By default, coarsens data to keep along-track resolution comparable to a single product. Optionally applies a function per frame and/or zooms to a region (without coarsening).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filepaths
|
Sequence[str] | NDArray[str_] | DataFrame
|
File paths (list) or DataFrame with |
required |
zoom_at
|
float | None
|
Fractional index for zoomed region; skips coarsening if set. |
None
|
along_track_dim
|
str
|
Concatenation dimension; defaults to ALONG_TRACK_DIM. |
ALONG_TRACK_DIM
|
func
|
Callable | None
|
Function applied to each frame after loading. |
None
|
func_inputs
|
Sequence[dict] | None
|
Per-frame arguments for |
None
|
max_num_files
|
int
|
Max files loaded at once; raises |
8
|
coarsen
|
bool
|
Coarsen data based on file count if True; ignored when |
True
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Concatenated dataset with all frames along |
Source code in earthcarekit/read/product/_concat.py
25 26 27 28 29 30 31 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 | |
read_science_data
#
read_science_data(
filepath: str, agency: FileAgency | None = None, ensure_nans: bool = False, **kwargs
) -> Dataset
Opens the science data of a EarthCARE file as a xarray.Dataset.
Source code in earthcarekit/read/science.py
rebin_msi_to_jsg
#
rebin_msi_to_jsg(
ds_msi: Dataset | str,
ds_xjsg: Dataset | str,
vars: list[str] | None = None,
k: int = 4,
eps: float = 1e-12,
lat_var: str = SWATH_LAT_VAR,
lon_var: str = SWATH_LON_VAR,
time_var: str = TIME_VAR,
along_track_dim: str = ALONG_TRACK_DIM,
across_track_dim: str = ACROSS_TRACK_DIM,
lat_var_xjsg: str = SWATH_LAT_VAR,
lon_var_xjsg: str = SWATH_LON_VAR,
time_var_xjsg: str = TIME_VAR,
along_track_dim_xjsg: str = ALONG_TRACK_DIM,
across_track_dim_xjsg: str = ACROSS_TRACK_DIM,
) -> Dataset
Rebins MSI variables onto the geo-spatial grid of an AUX_JSG_1D dataset.
Interpolates selected variables from ds_msi to ds_xjsg's lat/lon grid using kd-tree nearest-neighbor
search with inverse distance weighting of k neighbors. Output matches ds_xjsg's resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds_msi
|
Dataset | str
|
Source MSI dataset (e.g., MSI_RGR_1C, MSI_COP_2A). |
required |
ds_xjsg
|
Dataset | str
|
Target JSG dataset defining the output grid. |
required |
vars
|
list[str] | None
|
Variables to rebin; uses all if None. |
None
|
k
|
int
|
Number of nearest neighbors for interpolation; defaults to 4. |
4
|
eps
|
float
|
Numerical threshold to avoid division by zero; defaults to 1e-12. |
1e-12
|
lat_var
|
str
|
Latitude variable name in |
SWATH_LAT_VAR
|
lon_var
|
str
|
Longitude variable name in |
SWATH_LON_VAR
|
time_var
|
str
|
Time variable name in |
TIME_VAR
|
along_track_dim
|
str
|
Along-track dimension name in |
ALONG_TRACK_DIM
|
across_track_dim
|
str
|
Across-track dimension name in |
ACROSS_TRACK_DIM
|
lat_var_xjsg
|
str
|
Latitude variable name in |
SWATH_LAT_VAR
|
lon_var_xjsg
|
str
|
Longitude variable name in |
SWATH_LON_VAR
|
time_var_xjsg
|
str
|
Time variable name in |
TIME_VAR
|
along_track_dim_xjsg
|
str
|
Along-track dimension name in |
ALONG_TRACK_DIM
|
across_track_dim_xjsg
|
str
|
Across-track dimension name in |
ACROSS_TRACK_DIM
|
Returns:
| Type | Description |
|---|---|
Dataset
|
The MSI dataset with variables rebinned to the JSG grid. |
Source code in earthcarekit/read/product/_rebin_msi_to_jsg.py
29 30 31 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 | |
rebin_xmet_to_vertical_track
#
rebin_xmet_to_vertical_track(
ds_xmet: Dataset | str,
ds_vert: Dataset | str,
vars: list[str] | None = None,
k: int = 4,
eps: float = 1e-12,
lat_var: str = TRACK_LAT_VAR,
lon_var: str = TRACK_LON_VAR,
time_var: str = TIME_VAR,
height_var: str = HEIGHT_VAR,
along_track_dim: str = ALONG_TRACK_DIM,
height_dim: str = VERTICAL_DIM,
xmet_lat_var: str = "latitude",
xmet_lon_var: str = "longitude",
xmet_height_var: str = "geometrical_height",
xmet_height_dim: str = "height",
xmet_horizontal_grid_dim: str = "horizontal_grid",
) -> Dataset
Rebins AUX_MET_1D (XMET) variables onto the vertical curtain track of another dataset.
Interpolates selected variables from ds_xmet to ds_vert's vertical track using kd-tree nearest-neighbor
search with inverse distance weighting of k horizontal neighbors, followed by vertical interpolation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds_xmet
|
Dataset | str
|
Source XMET dataset. |
required |
ds_vert
|
Dataset | str
|
Target dataset defining the vertical curtain track (e.g., ATL_EBD_2A). |
required |
vars
|
list[str] | None
|
Variables to rebin; uses all if None. |
None
|
k
|
int
|
Number of nearest horizontal neighbors for interpolation; defaults to 4. |
4
|
eps
|
float
|
Numerical threshold to avoid division by zero; defaults to 1e-12. |
1e-12
|
lat_var
|
str
|
Latitude variable name in |
TRACK_LAT_VAR
|
lon_var
|
str
|
Longitude variable name in |
TRACK_LON_VAR
|
time_var
|
str
|
Time variable name in |
TIME_VAR
|
height_var
|
str
|
Height variable name in |
HEIGHT_VAR
|
along_track_dim
|
str
|
Along-track dimension name in |
ALONG_TRACK_DIM
|
height_dim
|
str
|
Vertical dimension name in |
VERTICAL_DIM
|
xmet_lat_var
|
str
|
Latitude variable name in |
'latitude'
|
xmet_lon_var
|
str
|
Longitude variable name in |
'longitude'
|
xmet_height_var
|
str
|
Height variable name in |
'geometrical_height'
|
xmet_height_dim
|
str
|
Vertical dimension name in |
'height'
|
xmet_horizontal_grid_dim
|
str
|
Horizontal grid dimension name in |
'horizontal_grid'
|
Returns:
| Type | Description |
|---|---|
Dataset
|
A new dataset with XMET variables interpolated to |
Raises:
| Type | Description |
|---|---|
KeyError
|
If any specified variable or coordinate is missing in |
Source code in earthcarekit/read/product/_rebin_xmet_to_vertical_track.py
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 | |
search_files_by_regex
#
Recursively searches for files matching a regex pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
PathLike
|
Root directory to search. |
required |
pattern
|
str
|
Regular expression pattern to match filenames. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Absolute paths to matching files. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If |
error
|
If |
Source code in earthcarekit/utils/path.py
search_product
#
search_product(
path_to_data: str | None = None,
config: str | ECKConfig | None = None,
file_type: str | Sequence[str] | None = None,
agency: str | Sequence[str] | None = None,
latency: str | Sequence[str] | None = None,
timestamp: TimestampLike | Sequence[TimestampLike] | None = None,
baseline: str | Sequence[str] | None = None,
orbit_and_frame: str | Sequence[str] | None = None,
orbit_number: int | str | Sequence[int | str] | None = None,
frame_id: str | Sequence[str] | None = None,
filename: str | Sequence[str] | None = None,
start_time: TimestampLike | None = None,
end_time: TimestampLike | None = None,
mode: Literal["exhaustive", "fast"] = "exhaustive",
read_geo_from_hdr: bool = False,
**kwargs
) -> ProductDataFrame
Searches for EarthCARE product files matching given metadata filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path_to_data
|
str | None
|
Root directory to search; uses config value if None. |
None
|
config
|
str | ECKConfig | None
|
Config file path or |
None
|
file_type
|
str | Sequence[str] | None
|
Product file type(s) to match. |
None
|
agency
|
str | Sequence[str] | None
|
Producing agency(ies) (e.g., "ESA", "JAXA"). |
None
|
latency
|
str | Sequence[str] | None
|
Data latency level(s). |
None
|
timestamp
|
TimestampLike | Sequence[TimestampLike] | None
|
Timestamp(s) included in the product's time coverage. |
None
|
baseline
|
str | Sequence[str] | None
|
Baseline version(s). |
None
|
orbit_and_frame
|
str | Sequence[str] | None
|
Orbit and frame identifiers. |
None
|
orbit_number
|
int | str | Sequence[int | str] | None
|
Orbit number(s). |
None
|
frame_id
|
str | Sequence[str] | None
|
Frame identifier(s). |
None
|
filename
|
str | Sequence[str] | None
|
Specific filename(s) or regex patterns to match. |
None
|
start_time
|
TimestampLike | None
|
First timestamp in the product's time coverage. |
None
|
end_time
|
TimestampLike | None
|
Last timestamp in the product's time coverage. |
None
|
mode
|
Literal['exhaustive', 'fast']
|
Search strategy ("exhaustive" or "fast"). |
'exhaustive'
|
read_geo_from_hdr
|
bool
|
Read geo-coordinates from |
False
|
Returns:
| Type | Description |
|---|---|
ProductDataFrame
|
A |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If root directory does not exist. |
Source code in earthcarekit/read/product/_search.py
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 | |
update_rgb
#
update_rgb(
ds: Dataset,
swir1_var: str = "swir1",
nir_var: str = "nir",
vis_var: str = "vis",
rgb_var: str = "rgb",
rgb_dim: str = "rgb_channel",
along_track_dim: str = "along_track",
across_track_dim: str = "across_track",
time_range: TimeRangeLike | None = None,
time_var: str = "time",
mask: Any = ...,
) -> Dataset
Computes and adds a false RGB data variable to the dataset (e.g., MSI_RGR_1C).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
Input dataset with SWIR1, NIR, and VIS variables. |
required |
swir1_var
|
str
|
SWIR1 variable name; defaults to "swir1". |
'swir1'
|
nir_var
|
str
|
NIR variable name; defaults to "nir". |
'nir'
|
vis_var
|
str
|
VIS variable name; defaults to "vis". |
'vis'
|
rgb_var
|
str
|
Output RGB variable name; defaults to "rgb". |
'rgb'
|
rgb_dim
|
str
|
RGB channel dimension name; defaults to "rgb_channel". |
'rgb_channel'
|
along_track_dim
|
str
|
Along-track dimension name; defaults to "along_track". |
'along_track'
|
across_track_dim
|
str
|
Across-track dimension name; defaults to "across_track". |
'across_track'
|
time_range
|
TimeRangeLike | None
|
Start/stop time range for masking; ignored when |
None
|
time_var
|
str
|
Time variable name; defaults to "time". |
'time'
|
mask
|
Any
|
Boolean mask; RGB composite ranges computed from masked data only, then applied to full dataset. |
...
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Dataset with false RGB image variable added. |