|
115 | 115 | " 'aster_collection': Collection(id='C1256584478-EEDTEST'),\n", |
116 | 116 | " 'measures_collection': Collection(id='C1258119317-EEDTEST'),\n", |
117 | 117 | " 'prefire_collection': Collection(id='C1263096190-EEDTEST'),\n", |
| 118 | + " 'antimeridian_collection': Collection(id='C1264760805-POCLOUD'),\n", |
| 119 | + " 'rgba_collection': Collection(id='C1259974840-ASF'),\n", |
118 | 120 | "}\n", |
119 | 121 | "\n", |
120 | 122 | "non_prod_granule_data = {\n", |
121 | 123 | " 'aster_granules': ['G1256584570-EEDTEST'],\n", |
122 | 124 | " 'measures_granules': ['G1258119387-EEDTEST'],\n", |
123 | 125 | " 'prefire_granules': ['G1263096192-EEDTEST'],\n", |
| 126 | + " 'antimeridian_granules': ['G1273054128-POCLOUD'],\n", |
| 127 | + " 'rgba_granules': ['G1269604594-ASF'],\n", |
124 | 128 | "}\n", |
125 | 129 | "\n", |
126 | 130 | "non_prod_variable_data = {\n", |
127 | | - " 'prefire_variable': 'Flx/olr',\n", |
| 131 | + " 'prefire_variable': 'flx',\n", |
128 | 132 | "}\n", |
129 | 133 | "\n", |
130 | 134 | "collection_data = {\n", |
|
766 | 770 | "id": "c567bc0e", |
767 | 771 | "metadata": {}, |
768 | 772 | "source": [ |
769 | | - "### Test that demonstrates variable selection for custom colour maps:\n", |
| 773 | + "### Test that demonstrates variable selection for custom colour maps and ±80° granule:\n", |
770 | 774 | "\n", |
771 | 775 | "This test will run a request that specifies a variable for HyBIG to use. It is a bit of a quirky way to ensure HyBIG has access to the related URL for a custom colour map. The output should be in colour rather than greyscale.\n", |
772 | 776 | "\n", |
773 | | - "PREFIRE granules also cover the whole Earth at sufficient resolution such that HyBIG will create tiled output, so there will be 15 tiles generated (3 rows, 5 columns).\n", |
| 777 | + "PREFIRE granules also cover the whole Earth at sufficient resolution such that HyBIG will create tiled output, so there will be 15 tiles generated (3 rows, 5 columns), with data covering an area above ±80° latitude.\n", |
774 | 778 | "\n", |
775 | 779 | "This test primarily seeks to ensure the values in the output images use the colour map specified in the related URLs of the specified [UMM-Var record](https://cmr.uat.earthdata.nasa.gov/search/variables.umm_json?concept_id=V1270130943-LARC_CLOUD)." |
776 | 780 | ] |
|
782 | 786 | "metadata": {}, |
783 | 787 | "outputs": [], |
784 | 788 | "source": [ |
785 | | - "'''This test appears to have been broken prior to 2.4.0, so disabling it.\n", |
786 | 789 | "if environment_information is not None:\n", |
787 | 790 | " prefire_basename = 'PREFIRE_SAT2_2B-FLX_S07_R00_20210721013413_03040.nc.G00'\n", |
788 | 791 | "\n", |
789 | | - " prefire_tiles = [\n", |
790 | | - " f'{prefire_basename}.r00c00',\n", |
791 | | - " f'{prefire_basename}.r00c01',\n", |
792 | | - " f'{prefire_basename}.r00c02',\n", |
793 | | - " f'{prefire_basename}.r00c03',\n", |
794 | | - " f'{prefire_basename}.r00c04',\n", |
795 | | - " f'{prefire_basename}.r01c00',\n", |
796 | | - " f'{prefire_basename}.r01c01',\n", |
797 | | - " f'{prefire_basename}.r01c02',\n", |
798 | | - " f'{prefire_basename}.r01c03',\n", |
799 | | - " f'{prefire_basename}.r01c04',\n", |
800 | | - " f'{prefire_basename}.r02c00',\n", |
801 | | - " f'{prefire_basename}.r02c01',\n", |
802 | | - " f'{prefire_basename}.r02c02',\n", |
803 | | - " f'{prefire_basename}.r02c03',\n", |
804 | | - " f'{prefire_basename}.r02c04',\n", |
805 | | - " ]\n", |
| 792 | + " prefire_tiles = []\n", |
| 793 | + " for r in range(3):\n", |
| 794 | + " for c in range(5):\n", |
| 795 | + " prefire_tiles.append(f'{prefire_basename}.r{r:02d}c{c:02d}')\n", |
806 | 796 | "\n", |
807 | 797 | " colour_map_reference_dir = reference_dir / 'colour_map'\n", |
808 | 798 | "\n", |
809 | 799 | " colour_map_request = Request(\n", |
810 | 800 | " collection=environment_information['prefire_collection'],\n", |
811 | 801 | " granule_id=environment_information['prefire_granules'][0],\n", |
812 | 802 | " variables=[environment_information['prefire_variable']],\n", |
| 803 | + " height=9000,\n", |
| 804 | + " width=18000,\n", |
| 805 | + " crs='EPSG:4326',\n", |
813 | 806 | " format='image/png',\n", |
814 | 807 | " )\n", |
815 | 808 | "\n", |
816 | | - " colour_map_job_id = harmony_client.submit(colour_map_request)\n", |
| 809 | + " colour_map_job_id = str(harmony_client.submit(colour_map_request))\n", |
817 | 810 | " harmony_client.wait_for_processing(colour_map_job_id, show_progress=True)\n", |
818 | 811 | "\n", |
819 | 812 | " with TemporaryDirectory() as temp_dir:\n", |
|
843 | 836 | " 'Conversion of PREFIRE GeoTIFF to PNG using custom colour map. Success'\n", |
844 | 837 | " )\n", |
845 | 838 | "else:\n", |
846 | | - " print('Skipping test: HyBIG regression tests not configured for this environment.')\n", |
847 | | - "'''" |
| 839 | + " print('Skipping test: HyBIG regression tests not configured for this environment.')" |
| 840 | + ] |
| 841 | + }, |
| 842 | + { |
| 843 | + "cell_type": "markdown", |
| 844 | + "id": "a4e5822b", |
| 845 | + "metadata": {}, |
| 846 | + "source": [ |
| 847 | + "### Test Polar Projection for browse image\n", |
| 848 | + "\n", |
| 849 | + "This test will run the same PREFIRE granule as the previous test, but using the North Polar Stereographic Projection at the output coordinate reference system (CRS). This also requires using the scaleExtent keyword, which is required for polar projections." |
| 850 | + ] |
| 851 | + }, |
| 852 | + { |
| 853 | + "cell_type": "code", |
| 854 | + "execution_count": null, |
| 855 | + "id": "593b216f", |
| 856 | + "metadata": {}, |
| 857 | + "outputs": [], |
| 858 | + "source": [ |
| 859 | + "if environment_information is not None:\n", |
| 860 | + " prefire_basename = 'PREFIRE_SAT2_2B-FLX_S07_R00_20210721013413_03040.nc.G00'\n", |
| 861 | + " polar_extent = [-4194304.0, -4194304.0, 4194304.0, 4194304.0]\n", |
| 862 | + "\n", |
| 863 | + " # Polar projections have square output dimensions, while geographic projection has rectangular dimensions (2x wider than height)\n", |
| 864 | + " # We expect to receive a single tile.\n", |
| 865 | + " prefire_tiles = [prefire_basename]\n", |
| 866 | + "\n", |
| 867 | + " polar_reference_dir = reference_dir / 'polar'\n", |
| 868 | + "\n", |
| 869 | + " polar_request = Request(\n", |
| 870 | + " collection=environment_information['prefire_collection'],\n", |
| 871 | + " granule_id=environment_information['prefire_granules'][0],\n", |
| 872 | + " variables=[environment_information['prefire_variable']],\n", |
| 873 | + " scale_extent=polar_extent,\n", |
| 874 | + " crs='EPSG:3413',\n", |
| 875 | + " format='image/png',\n", |
| 876 | + " )\n", |
| 877 | + "\n", |
| 878 | + " polar_job_id = str(harmony_client.submit(polar_request))\n", |
| 879 | + " harmony_client.wait_for_processing(polar_job_id, show_progress=True)\n", |
| 880 | + "\n", |
| 881 | + " with TemporaryDirectory() as temp_dir:\n", |
| 882 | + " downloaded_colour_map_outputs = [\n", |
| 883 | + " file_future.result()\n", |
| 884 | + " for file_future in harmony_client.download_all(\n", |
| 885 | + " polar_job_id, overwrite=True, directory=temp_dir\n", |
| 886 | + " )\n", |
| 887 | + " ]\n", |
| 888 | + "\n", |
| 889 | + " for tile_basename in prefire_tiles:\n", |
| 890 | + " tile_reference_files = build_file_list(\n", |
| 891 | + " tile_basename, polar_reference_dir, 'PNG'\n", |
| 892 | + " )\n", |
| 893 | + " tile_result_files = build_file_list(tile_basename, Path(temp_dir), 'PNG')\n", |
| 894 | + "\n", |
| 895 | + " for file_name in tile_result_files:\n", |
| 896 | + " assert file_name.exists(), f'File does not exist {file_name.resolve()}'\n", |
| 897 | + "\n", |
| 898 | + " print_success(f'All {tile_basename} test files generated')\n", |
| 899 | + "\n", |
| 900 | + " assert_dataset_produced_correct_results(\n", |
| 901 | + " tile_result_files[0], tile_reference_files[0], 'PNG'\n", |
| 902 | + " )\n", |
| 903 | + "\n", |
| 904 | + " print_success(\n", |
| 905 | + " 'Conversion of PREFIRE GeoTIFF to PNG using polar projection. Success'\n", |
| 906 | + " )\n", |
| 907 | + "else:\n", |
| 908 | + " print('Skipping test: HyBIG regression tests not configured for this environment.')" |
| 909 | + ] |
| 910 | + }, |
| 911 | + { |
| 912 | + "cell_type": "markdown", |
| 913 | + "id": "4ec2cc84", |
| 914 | + "metadata": {}, |
| 915 | + "source": [ |
| 916 | + "### Test OPERA DSWx-S1 anti-meridian granule:\n", |
| 917 | + "\n", |
| 918 | + "This test will run a request using an OPERA DSWx-S1 granule from PODAAC, to demonstrate performance in anti-meridian crossings. The output will be saved to a separate antimeridian directory." |
| 919 | + ] |
| 920 | + }, |
| 921 | + { |
| 922 | + "cell_type": "code", |
| 923 | + "execution_count": null, |
| 924 | + "id": "fedfef39", |
| 925 | + "metadata": {}, |
| 926 | + "outputs": [], |
| 927 | + "source": [ |
| 928 | + "antimeridian_basename = (\n", |
| 929 | + " 'OPERA_L3_DSWx-S1_T01LAC_20250212T174046Z_20250214T045358Z_S1A_30_v1.0_B01_WTR'\n", |
| 930 | + ")\n", |
| 931 | + "antimeridian_reference_dir = reference_dir / 'antimeridian'\n", |
| 932 | + "\n", |
| 933 | + "if environment_information is not None:\n", |
| 934 | + " antimeridian_request = Request(\n", |
| 935 | + " collection=environment_information['antimeridian_collection'],\n", |
| 936 | + " granule_id=environment_information['antimeridian_granules'][0],\n", |
| 937 | + " crs='EPSG:4326',\n", |
| 938 | + " format='image/png',\n", |
| 939 | + " )\n", |
| 940 | + "\n", |
| 941 | + " antimeridian_job_id = str(harmony_client.submit(antimeridian_request))\n", |
| 942 | + " harmony_client.wait_for_processing(antimeridian_job_id, show_progress=True)\n", |
| 943 | + "\n", |
| 944 | + " reference_files = build_file_list(\n", |
| 945 | + " antimeridian_basename, antimeridian_reference_dir, 'PNG'\n", |
| 946 | + " )\n", |
| 947 | + "\n", |
| 948 | + " with TemporaryDirectory() as temp_dir:\n", |
| 949 | + " downloaded_grid_outputs = [\n", |
| 950 | + " file_future.result()\n", |
| 951 | + " for file_future in harmony_client.download_all(\n", |
| 952 | + " antimeridian_job_id, overwrite=True, directory=temp_dir\n", |
| 953 | + " )\n", |
| 954 | + " ]\n", |
| 955 | + "\n", |
| 956 | + " test_result_files = build_file_list(\n", |
| 957 | + " antimeridian_basename, Path(temp_dir), 'PNG'\n", |
| 958 | + " )\n", |
| 959 | + " for file_name in test_result_files:\n", |
| 960 | + " assert file_name.exists(), f'File does not exist {file_name.resolve()}'\n", |
| 961 | + "\n", |
| 962 | + " print_success('all test files generated')\n", |
| 963 | + "\n", |
| 964 | + " assert_dataset_produced_correct_results(\n", |
| 965 | + " test_result_files[0], reference_files[0], 'PNG'\n", |
| 966 | + " )\n", |
| 967 | + "\n", |
| 968 | + " print_success('Conversion of OPERA antimeridian data to PNG Success')\n", |
| 969 | + "else:\n", |
| 970 | + " print('Skipping test: HyBIG regression tests not configured for this environment.')" |
| 971 | + ] |
| 972 | + }, |
| 973 | + { |
| 974 | + "cell_type": "markdown", |
| 975 | + "id": "1eaad451", |
| 976 | + "metadata": {}, |
| 977 | + "source": [ |
| 978 | + "### Test OPERA RTC RGBA:\n", |
| 979 | + "\n", |
| 980 | + "This test will run a request using an OPERA RTC granule, to demonstrate performance with RGBA. Alternatively, MODIS corrected reflectance granules can be used. This collection gets converted to RGBA within the Harmony service chain prior to reaching HyBIG. The output will be saved to a separate rgba directory.\n", |
| 981 | + "\n", |
| 982 | + "**Note**: This collection requires you to accept a EULA before you can download granules. Please try downloading a granule manually [here](https://search.uat.earthdata.nasa.gov/search/granules?p=C1259974840-ASF&pg[0][v]=f&pg[0][qt]=2024-09-11T00%3A00%3A00.000Z%2C&pg[0][id]=OPERA_L2_RTC-S1_T063-133291-IW3_20240911T000822Z_20240911T114658Z*&pg[0][gsk]=start_date&g=G1269604594-ASF&q=C1259974840-ASF&lat=21.077285&long=-89.23667086956522&zoom=9.937662345674783) and accepting the click-through agreement. " |
| 983 | + ] |
| 984 | + }, |
| 985 | + { |
| 986 | + "cell_type": "code", |
| 987 | + "execution_count": null, |
| 988 | + "id": "1a8ad2a1", |
| 989 | + "metadata": {}, |
| 990 | + "outputs": [], |
| 991 | + "source": [ |
| 992 | + "# Corresponds to OPERA_L2_RTC-S1_T063-133291-IW3_20240911T000822Z_20240911T114658Z_S1A_30_v1.0\n", |
| 993 | + "# Area is over Merida, Mexico\n", |
| 994 | + "rgba_basename = '1c1aad567673d6612e25799705600f9262dfc81a171a8a9a586858ee4bfeb_rgb'\n", |
| 995 | + "rgba_reference_dir = reference_dir / 'rgba'\n", |
| 996 | + "\n", |
| 997 | + "if environment_information is not None:\n", |
| 998 | + " rgba_request = Request(\n", |
| 999 | + " collection=environment_information['rgba_collection'],\n", |
| 1000 | + " granule_id=environment_information['rgba_granules'][0],\n", |
| 1001 | + " crs='EPSG:4326',\n", |
| 1002 | + " format='image/png',\n", |
| 1003 | + " )\n", |
| 1004 | + "\n", |
| 1005 | + " rgba_job_id = str(harmony_client.submit(rgba_request))\n", |
| 1006 | + " harmony_client.wait_for_processing(rgba_job_id, show_progress=True)\n", |
| 1007 | + "\n", |
| 1008 | + " reference_files = build_file_list(rgba_basename, rgba_reference_dir, 'PNG')\n", |
| 1009 | + "\n", |
| 1010 | + " with TemporaryDirectory() as temp_dir:\n", |
| 1011 | + " downloaded_grid_outputs = [\n", |
| 1012 | + " file_future.result()\n", |
| 1013 | + " for file_future in harmony_client.download_all(\n", |
| 1014 | + " rgba_job_id, overwrite=True, directory=temp_dir\n", |
| 1015 | + " )\n", |
| 1016 | + " ]\n", |
| 1017 | + "\n", |
| 1018 | + " test_result_files = build_file_list(rgba_basename, Path(temp_dir), 'PNG')\n", |
| 1019 | + " for file_name in test_result_files:\n", |
| 1020 | + " assert file_name.exists(), f'File does not exist {file_name.resolve()}'\n", |
| 1021 | + "\n", |
| 1022 | + " print_success('all test files generated')\n", |
| 1023 | + "\n", |
| 1024 | + " assert_dataset_produced_correct_results(\n", |
| 1025 | + " test_result_files[0], reference_files[0], 'PNG'\n", |
| 1026 | + " )\n", |
| 1027 | + "\n", |
| 1028 | + " print_success('Conversion of OPERA RTC RGBA data to PNG Success')\n", |
| 1029 | + "else:\n", |
| 1030 | + " print('Skipping test: HyBIG regression tests not configured for this environment.')" |
848 | 1031 | ] |
849 | 1032 | } |
850 | 1033 | ], |
851 | 1034 | "metadata": { |
852 | 1035 | "celltoolbar": "Tags", |
853 | 1036 | "kernelspec": { |
854 | | - "display_name": "venv", |
| 1037 | + "display_name": "papermill-hybig", |
855 | 1038 | "language": "python", |
856 | 1039 | "name": "python3" |
857 | 1040 | }, |
|
865 | 1048 | "name": "python", |
866 | 1049 | "nbconvert_exporter": "python", |
867 | 1050 | "pygments_lexer": "ipython3", |
868 | | - "version": "3.13.2" |
| 1051 | + "version": "3.10.19" |
869 | 1052 | } |
870 | 1053 | }, |
871 | 1054 | "nbformat": 4, |
|
0 commit comments