|
36 | 36 | print(json.dumps(config, indent=4, sort_keys=True)) |
37 | 37 | xlim = [config["minlongitude"], config["maxlongitude"]] |
38 | 38 | ylim = [config["minlatitude"], config["maxlatitude"]] |
| 39 | +if "mindepth" not in config: |
| 40 | + config["mindepth"] = 0 |
| 41 | +if "maxdepth" not in config: |
| 42 | + config["maxdepth"] = 60 |
| 43 | +zlim = [config["mindepth"], config["maxdepth"]] |
| 44 | + |
39 | 45 |
|
40 | 46 | # %% |
41 | 47 | # %% |
|
485 | 491 | for j in range(3): |
486 | 492 | ax[i, j].grid() |
487 | 493 |
|
488 | | -if routine_exist and (len(routine_catalog) > 0): |
489 | | - ax[0, 0].scatter( |
490 | | - routine_catalog["longitude"], |
491 | | - routine_catalog["depth_km"], |
492 | | - c=routine_catalog["depth_km"], |
493 | | - s=8000 / len(routine_catalog), |
| 494 | +xlim = None |
| 495 | +ylim = None |
| 496 | +if adloc_exist and (len(adloc_catalog) > 0): |
| 497 | + ax[0, 2].scatter( |
| 498 | + adloc_catalog["longitude"], |
| 499 | + adloc_catalog["depth_km"], |
| 500 | + c=adloc_catalog["depth_km"], |
| 501 | + s=8000 / len(adloc_catalog), |
494 | 502 | alpha=1.0, |
495 | 503 | linewidth=0, |
496 | 504 | vmin=cmin, |
497 | 505 | vmax=cmax, |
498 | 506 | cmap="viridis_r", |
499 | | - label=f"Routine: {len(routine_catalog)}", |
| 507 | + label=f"AdLoc: {len(adloc_catalog)}", |
500 | 508 | ) |
501 | | - ax[0, 0].set_title(f"Routine: {len(routine_catalog)}") |
502 | | - # ax[0, 0].invert_yaxis() |
503 | | - xlim = ax[0, 0].get_xlim() |
504 | | - ylim = ax[0, 0].get_ylim() |
505 | | -else: |
506 | | - xlim = None |
507 | | - ylim = None |
| 509 | + # ax[0, 2].legend() |
| 510 | + ax[0, 2].set_title(f"AdLoc: {len(adloc_catalog)}") |
| 511 | + if (xlim is None) and (ylim is None): |
| 512 | + ax[0, 2].invert_yaxis() |
| 513 | + xlim = ax[0, 2].get_xlim() |
| 514 | + ylim = ax[0, 2].get_ylim() |
| 515 | + else: |
| 516 | + ax[0, 2].set_xlim(xlim) |
| 517 | + ax[0, 2].set_ylim(ylim) |
508 | 518 |
|
509 | 519 | if gamma_exist and (len(gamma_catalog) > 0): |
510 | 520 | ax[0, 1].scatter( |
|
520 | 530 | label=f"GaMMA: {len(gamma_catalog)}", |
521 | 531 | ) |
522 | 532 | ax[0, 1].set_title(f"GaMMA: {len(gamma_catalog)}") |
523 | | - ax[0, 1].invert_yaxis() |
524 | | - xlim = ax[0, 1].get_xlim() |
525 | | - ylim = ax[0, 1].get_ylim() |
526 | | -else: |
527 | | - xlim = None |
528 | | - ylim = None |
| 533 | + if (xlim is None) and (ylim is None): |
| 534 | + ax[0, 1].invert_yaxis() |
| 535 | + xlim = ax[0, 1].get_xlim() |
| 536 | + ylim = ax[0, 1].get_ylim() |
| 537 | + else: |
| 538 | + ax[0, 1].set_xlim(xlim) |
| 539 | + ax[0, 1].set_ylim(ylim) |
529 | 540 |
|
530 | | -if adloc_exist and (len(adloc_catalog) > 0): |
531 | | - ax[0, 2].scatter( |
532 | | - adloc_catalog["longitude"], |
533 | | - adloc_catalog["depth_km"], |
534 | | - c=adloc_catalog["depth_km"], |
535 | | - s=8000 / len(adloc_catalog), |
| 541 | +if routine_exist and (len(routine_catalog) > 0): |
| 542 | + ax[0, 0].scatter( |
| 543 | + routine_catalog["longitude"], |
| 544 | + routine_catalog["depth_km"], |
| 545 | + c=routine_catalog["depth_km"], |
| 546 | + s=8000 / len(routine_catalog), |
536 | 547 | alpha=1.0, |
537 | 548 | linewidth=0, |
538 | 549 | vmin=cmin, |
539 | 550 | vmax=cmax, |
540 | 551 | cmap="viridis_r", |
541 | | - label=f"AdLoc: {len(adloc_catalog)}", |
| 552 | + label=f"Routine: {len(routine_catalog)}", |
542 | 553 | ) |
543 | | - # ax[0, 2].legend() |
544 | | - ax[0, 2].set_title(f"AdLoc: {len(adloc_catalog)}") |
545 | | - ax[0, 2].set_xlim(xlim) |
546 | | - ax[0, 2].set_ylim(ylim) |
| 554 | + ax[0, 0].set_title(f"Routine: {len(routine_catalog)}") |
| 555 | + if (xlim is None) and (ylim is None): |
| 556 | + ax[0, 0].invert_yaxis() |
| 557 | + xlim = ax[0, 0].get_xlim() |
| 558 | + ylim = ax[0, 0].get_ylim() |
| 559 | + else: |
| 560 | + ax[0, 0].set_xlim(xlim) |
| 561 | + ax[0, 0].set_ylim(ylim) |
547 | 562 |
|
548 | 563 | if qtm_exist and (len(qtm_catalog) > 0): |
549 | 564 | ax[1, 2].scatter( |
|
669 | 684 | fig, ax = plt.subplots(4, 3, squeeze=False, figsize=(20, 30), sharex=True, sharey=True) |
670 | 685 | cmin = 0 |
671 | 686 | cmax = 10 |
| 687 | +xlim = None |
| 688 | +ylim = None |
672 | 689 | for i in range(4): |
673 | 690 | for j in range(3): |
674 | 691 | ax[i, j].grid() |
675 | 692 |
|
676 | | -if routine_exist and (len(routine_catalog) > 0): |
677 | | - ax[0, 0].scatter( |
678 | | - routine_catalog["latitude"], |
679 | | - routine_catalog["depth_km"], |
680 | | - c=routine_catalog["depth_km"], |
681 | | - s=8000 / len(routine_catalog), |
| 693 | +if adloc_exist and (len(adloc_catalog) > 0): |
| 694 | + ax[0, 2].scatter( |
| 695 | + adloc_catalog["latitude"], |
| 696 | + adloc_catalog["depth_km"], |
| 697 | + c=adloc_catalog["depth_km"], |
| 698 | + s=8000 / len(adloc_catalog), |
682 | 699 | alpha=1.0, |
683 | 700 | linewidth=0, |
684 | 701 | vmin=cmin, |
685 | 702 | vmax=cmax, |
686 | 703 | cmap="viridis_r", |
687 | | - label=f"Routine: {len(routine_catalog)}", |
| 704 | + label=f"AdLoc: {len(adloc_catalog)}", |
688 | 705 | ) |
689 | | - ax[0, 0].set_title(f"Routine: {len(routine_catalog)}") |
690 | | - # ax[0, 0].invert_yaxis() |
691 | | - xlim = ax[0, 0].get_xlim() |
692 | | - ylim = ax[0, 0].get_ylim() |
693 | | -else: |
694 | | - xlim = None |
695 | | - ylim = None |
| 706 | + # ax[0, 2].legend() |
| 707 | + ax[0, 2].set_title(f"AdLoc: {len(adloc_catalog)}") |
| 708 | + if (xlim is None) and (ylim is None): |
| 709 | + ax[0, 2].invert_yaxis() |
| 710 | + xlim = ax[0, 2].get_xlim() |
| 711 | + ylim = ax[0, 2].get_ylim() |
| 712 | + else: |
| 713 | + ax[0, 2].set_xlim(xlim) |
| 714 | + ax[0, 2].set_ylim(ylim) |
696 | 715 |
|
697 | 716 | if gamma_exist and (len(gamma_catalog) > 0): |
698 | 717 | ax[0, 1].scatter( |
|
708 | 727 | label=f"GaMMA: {len(gamma_catalog)}", |
709 | 728 | ) |
710 | 729 | ax[0, 1].set_title(f"GaMMA: {len(gamma_catalog)}") |
711 | | - ax[0, 1].invert_yaxis() |
712 | | - xlim = ax[0, 1].get_xlim() |
713 | | - ylim = ax[0, 1].get_ylim() |
714 | | -else: |
715 | | - xlim = None |
716 | | - ylim = None |
| 730 | + if (xlim is None) and (ylim is None): |
| 731 | + ax[0, 1].invert_yaxis() |
| 732 | + xlim = ax[0, 1].get_xlim() |
| 733 | + ylim = ax[0, 1].get_ylim() |
| 734 | + else: |
| 735 | + ax[0, 1].set_xlim(xlim) |
| 736 | + ax[0, 1].set_ylim(ylim) |
717 | 737 |
|
718 | | -if adloc_exist and (len(adloc_catalog) > 0): |
719 | | - ax[0, 2].scatter( |
720 | | - adloc_catalog["latitude"], |
721 | | - adloc_catalog["depth_km"], |
722 | | - c=adloc_catalog["depth_km"], |
723 | | - s=8000 / len(adloc_catalog), |
| 738 | +if routine_exist and (len(routine_catalog) > 0): |
| 739 | + ax[0, 0].scatter( |
| 740 | + routine_catalog["latitude"], |
| 741 | + routine_catalog["depth_km"], |
| 742 | + c=routine_catalog["depth_km"], |
| 743 | + s=8000 / len(routine_catalog), |
724 | 744 | alpha=1.0, |
725 | 745 | linewidth=0, |
726 | 746 | vmin=cmin, |
727 | 747 | vmax=cmax, |
728 | 748 | cmap="viridis_r", |
729 | | - label=f"AdLoc: {len(adloc_catalog)}", |
| 749 | + label=f"Routine: {len(routine_catalog)}", |
730 | 750 | ) |
731 | | - # ax[0, 2].legend() |
732 | | - ax[0, 2].set_title(f"AdLoc: {len(adloc_catalog)}") |
733 | | - ax[0, 2].set_xlim(xlim) |
734 | | - ax[0, 2].set_ylim(ylim) |
| 751 | + ax[0, 0].set_title(f"Routine: {len(routine_catalog)}") |
| 752 | + if (xlim is None) and (ylim is None): |
| 753 | + ax[0, 0].invert_yaxis() |
| 754 | + xlim = ax[0, 0].get_xlim() |
| 755 | + ylim = ax[0, 0].get_ylim() |
| 756 | + else: |
| 757 | + ax[0, 0].set_xlim(xlim) |
| 758 | + ax[0, 0].set_ylim(ylim) |
735 | 759 |
|
736 | 760 | if qtm_exist and (len(qtm_catalog) > 0): |
737 | 761 | ax[1, 2].scatter( |
|
906 | 930 |
|
907 | 931 | # %% |
908 | 932 | fig, ax = plt.subplots(2, 1, squeeze=False, figsize=(10, 10)) |
909 | | -xlim = [int(np.floor(gamma_catalog["magnitude"].min())), int(np.ceil(gamma_catalog["magnitude"].max()))] |
910 | | -bins = np.arange(xlim[0], xlim[1] + 1, 0.2) |
| 933 | +if gamma_exist: |
| 934 | + xlim = [int(np.floor(gamma_catalog["magnitude"].min())), int(np.ceil(gamma_catalog["magnitude"].max()))] |
| 935 | + bins = np.arange(xlim[0], xlim[1] + 1, 0.2) |
| 936 | +elif adloc_exist: |
| 937 | + xlim = [int(np.floor(adloc_catalog["magnitude"].min())), int(np.ceil(adloc_catalog["magnitude"].max()))] |
| 938 | + bins = np.arange(xlim[0], xlim[1] + 1, 0.2) |
| 939 | +elif routine_exist: |
| 940 | + xlim = [int(np.floor(routine_catalog["magnitude"].min())), int(np.ceil(routine_catalog["magnitude"].max()))] |
| 941 | + bins = np.arange(xlim[0], xlim[1] + 1, 0.2) |
| 942 | +else: |
| 943 | + raise ValueError("No catalog found") |
911 | 944 | if routine_exist: |
912 | 945 | ax[0, 0].hist(routine_catalog["magnitude"], bins=bins, alpha=0.5, label="Routine") |
913 | 946 | ax[1, 0].hist(routine_catalog["magnitude"], bins=bins, alpha=0.5, label="Routine") |
|
0 commit comments