hysplit
HYSPLIT Reader
HYSPLITReader
Bases: GriddedReader
Source code in monetio/readers/hysplit.py
14 15 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 | |
open_dataset(files, drange=None, century=None, verbose=False, sample_time_stamp='start', check_grid=True, lazy=False, **kwargs)
Reads HYSPLIT binary concentration (cdump) files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
Union[str, List[str]]
|
File path(s), URL(s), or glob pattern. |
required |
drange
|
List[datetime]
|
Date range to filter, by default None. |
None
|
century
|
int
|
Century to use for 2-digit years (e.g. 2000), by default None. |
None
|
verbose
|
bool
|
Whether to print verbose output, by default False. |
False
|
sample_time_stamp
|
str
|
Time stamp to use ('start' or 'end'), by default "start". |
'start'
|
check_grid
|
bool
|
Whether to fix grid continuity, by default True. |
True
|
lazy
|
bool
|
Whether to use Dask for lazy loading, by default False. |
False
|
**kwargs
|
Any
|
Additional arguments passed to the driver. |
{}
|
Returns:
| Type | Description |
|---|---|
Dataset
|
The processed HYSPLIT dataset. |
Source code in monetio/readers/hysplit.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 | |
add_species(dset, species=None)
Sum multiple species into a single DataArray/Dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dset
|
Dataset
|
Input HYSPLIT dataset. |
required |
species
|
list[str]
|
List of species to sum. If None, all species in 'Species ID' attribute are used. |
None
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Dataset with the summed species. |
Source code in monetio/readers/hysplit.py
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 | |
check_grid_continuity(dset)
Check if the grid indices x and y are continuous (step of 1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dset
|
Dataset
|
Input dataset. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if grid is continuous. |
Source code in monetio/readers/hysplit.py
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | |
fix_grid_continuity(dset)
Fix grid continuity by reindexing to a full integer range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dset
|
Dataset
|
Input HYSPLIT dataset. |
required |
Returns:
| Type | Description |
|---|---|
Dataset
|
Dataset with continuous grid. |
Source code in monetio/readers/hysplit.py
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 | |
get_latlongrid(attrs, xindx, yindx)
Generate 2D latitude and longitude grids from HYSPLIT attributes and indices.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attrs
|
dict
|
HYSPLIT grid attributes. |
required |
xindx
|
ndarray
|
X-indices (1-based). |
required |
yindx
|
ndarray
|
Y-indices (1-based). |
required |
Returns:
| Type | Description |
|---|---|
list[ndarray]
|
[longitude_2d, latitude_2d] |
Source code in monetio/readers/hysplit.py
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 | |
get_thickness(xrash)
Calculate layer thicknesses from vertical coordinates backend-agnostic.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xrash
|
Dataset | DataArray
|
Dataset containing vertical dimension 'z'. |
required |
Returns:
| Type | Description |
|---|---|
DataArray
|
Thickness of each layer. |
Source code in monetio/readers/hysplit.py
770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | |
getlatlon(attrs)
Generate 1D latitude and longitude arrays from HYSPLIT attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attrs
|
dict
|
HYSPLIT grid attributes. |
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
(latitude, longitude) |
Source code in monetio/readers/hysplit.py
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 | |
mass_loading(xrash, delta=None)
Calculate mass loading by vertically integrating concentration lazily.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xrash
|
DataArray | Dataset
|
Input data with concentration. |
required |
delta
|
DataArray | ndarray
|
Layer thicknesses. If None, calculated from 'z'. |
None
|
Returns:
| Type | Description |
|---|---|
DataArray | Dataset
|
Mass loading (sum of conc * delta). |
Source code in monetio/readers/hysplit.py
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 861 862 863 864 865 866 867 868 869 870 | |
remove_dep(xrash)
Mask the deposition layer (z=0) if present backend-agnostic. Keeps the same shape but replaces z=0 values with NaN to remain lazy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xrash
|
Dataset | DataArray
|
Input data. |
required |
Returns:
| Type | Description |
|---|---|
Dataset | DataArray
|
Data with deposition layer masked. |
Source code in monetio/readers/hysplit.py
794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 | |
thickness_hash(xrash)
Map layer heights to their thicknesses.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xrash
|
Dataset | DataArray
|
Dataset containing vertical dimension 'z'. |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary mapping height to thickness. |
Source code in monetio/readers/hysplit.py
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | |