|
35 | 35 | "from xml.dom import minidom" |
36 | 36 | ] |
37 | 37 | }, |
| 38 | + { |
| 39 | + "cell_type": "markdown", |
| 40 | + "id": "e80baccd", |
| 41 | + "metadata": {}, |
| 42 | + "source": [ |
| 43 | + "## Constants" |
| 44 | + ] |
| 45 | + }, |
| 46 | + { |
| 47 | + "cell_type": "code", |
| 48 | + "execution_count": null, |
| 49 | + "id": "5df6c714", |
| 50 | + "metadata": {}, |
| 51 | + "outputs": [], |
| 52 | + "source": [ |
| 53 | + "# Base path where configuration and executables have been installed\n", |
| 54 | + "install_base_path = \"/pge\"\n", |
| 55 | + "\n", |
| 56 | + "# The following are defaults for when the environemnt variables referenced below are not found\n", |
| 57 | + "\n", |
| 58 | + "# Where PGE static config files\n", |
| 59 | + "config_static_path = os.environ.get(\"PGE_STATIC_CONFIG_PATH\", os.path.join(install_base_path, \"config\"))\n", |
| 60 | + "\n", |
| 61 | + "# Where PGE binaries are located\n", |
| 62 | + "pge_bin_path = os.environ.get(\"PGE_BINARY_PATH\", os.path.join(install_base_path, \"bin\"))\n", |
| 63 | + "\n", |
| 64 | + "# Where PGE static data files are looked for in a predictable location\n", |
| 65 | + "# This path needs to be constant because the static config files are\n", |
| 66 | + "# rewritten to point to it.\n", |
| 67 | + "data_static_path_local = os.environ.get(\"PGE_STATIC_DATA_PATH\", \"/tmp/static\")" |
| 68 | + ] |
| 69 | + }, |
38 | 70 | { |
39 | 71 | "cell_type": "markdown", |
40 | 72 | "id": "0f1c1c7e", |
|
54 | 86 | }, |
55 | 87 | "outputs": [], |
56 | 88 | "source": [ |
57 | | - "# Location of input L0 files\n", |
58 | | - "input_path = \"/pge/in\"\n", |
| 89 | + "# Location of input L1A files\n", |
| 90 | + "input_path = \"/tmp/in\"\n", |
59 | 91 | "\n", |
60 | 92 | "# Where PGE output files and log files get written\n", |
61 | | - "output_path = \"/pge/out\"\n", |
62 | | - "\n", |
63 | | - "# Where PGE static config files\n", |
64 | | - "config_static_path = \"/pge/static\"\n", |
| 93 | + "output_path = \"/tmp/out\"\n", |
65 | 94 | "\n", |
66 | 95 | "# Enable verbose logging\n", |
67 | 96 | "verbose = True" |
|
74 | 103 | "metadata": {}, |
75 | 104 | "outputs": [], |
76 | 105 | "source": [ |
77 | | - "# converting to absolute path if relative paths passed in\n", |
78 | | - "\n", |
79 | | - "if not input_path.startswith('/'):\n", |
80 | | - " input_path = os.path.abspath(input_path)\n", |
81 | | - "\n", |
82 | | - "if not output_path.startswith('/'):\n", |
83 | | - " output_path = os.path.abspath(output_path)\n", |
84 | | - "\n", |
85 | | - "if not config_static_path.startswith('/'):\n", |
86 | | - " config_static_path = os.path.abspath(config_static_path)" |
| 106 | + "# Converting to absolute path to remove any relative paths\n", |
| 107 | + "input_path = os.path.realpath(input_path)\n", |
| 108 | + "output_path = os.path.realpath(output_path)" |
87 | 109 | ] |
88 | 110 | }, |
89 | 111 | { |
90 | 112 | "cell_type": "markdown", |
91 | | - "id": "e80baccd", |
| 113 | + "id": "b9f00c55-7836-4b0f-a26b-eb0ca1c4e3b6", |
92 | 114 | "metadata": {}, |
93 | 115 | "source": [ |
94 | | - "## Constants" |
| 116 | + "## Configuration" |
95 | 117 | ] |
96 | 118 | }, |
97 | 119 | { |
98 | 120 | "cell_type": "code", |
99 | 121 | "execution_count": null, |
100 | | - "id": "5df6c714", |
| 122 | + "id": "af083a72-c0db-4edd-8c6e-4169d75d2200", |
101 | 123 | "metadata": {}, |
102 | 124 | "outputs": [], |
103 | 125 | "source": [ |
|
111 | 133 | "log_filename = os.path.join(output_path, \"L1BMw_main.log\")\n", |
112 | 134 | "\n", |
113 | 135 | "# Location of PGE executable\n", |
114 | | - "pge_executable = \"/pge/bin/L1BMw_main\"\n", |
| 136 | + "pge_executable = os.path.join(pge_bin_path, \"L1BMw_main\")\n", |
115 | 137 | "\n", |
116 | 138 | "# Location of MetExtractor executable\n", |
117 | | - "met_extractor_executable = \"/pge/bin/MetExtractor\"" |
| 139 | + "met_extractor_executable = os.path.join(pge_bin_path, \"MetExtractor\")" |
| 140 | + ] |
| 141 | + }, |
| 142 | + { |
| 143 | + "cell_type": "markdown", |
| 144 | + "id": "613bb42b-25e2-4408-bec0-2011d2683207", |
| 145 | + "metadata": {}, |
| 146 | + "source": [ |
| 147 | + "## Enviroment Variables" |
| 148 | + ] |
| 149 | + }, |
| 150 | + { |
| 151 | + "cell_type": "code", |
| 152 | + "execution_count": null, |
| 153 | + "id": "9483cea1-aa0c-4ca4-ae41-bd9885a30136", |
| 154 | + "metadata": {}, |
| 155 | + "outputs": [], |
| 156 | + "source": [ |
| 157 | + "# These need to be defined for the PGS Toolkit to find its files\n", |
| 158 | + "# Values supplied by the runtime environment take precedence\n", |
| 159 | + "if not \"PGSHOME\" in os.environ:\n", |
| 160 | + " os.environ[\"PGSHOME\"] = \"/opt/packages/sdptk5.2.20v1.01/TOOLKIT/\"\n", |
| 161 | + " \n", |
| 162 | + "if not \"PGS_PC_INFO_FILE\" in os.environ:\n", |
| 163 | + " os.environ[\"PGS_PC_INFO_FILE\"] = os.path.join(config_static_path, \"SNDR.PGSToolkit_ProcessControlFile.pcf\")\n", |
| 164 | + " \n", |
| 165 | + "if not \"PGS_LEAPSEC_FILE\" in os.environ:\n", |
| 166 | + " os.environ[\"PGS_LEAPSEC_FILE\"] = os.path.join(os.environ[\"PGSHOME\"], \"leapsec.dat\")" |
118 | 167 | ] |
119 | 168 | }, |
120 | 169 | { |
|
451 | 500 | ], |
452 | 501 | "metadata": { |
453 | 502 | "kernelspec": { |
454 | | - "display_name": "Python 3", |
| 503 | + "display_name": "Python 3 (ipykernel)", |
455 | 504 | "language": "python", |
456 | 505 | "name": "python3" |
457 | 506 | }, |
|
465 | 514 | "name": "python", |
466 | 515 | "nbconvert_exporter": "python", |
467 | 516 | "pygments_lexer": "ipython3", |
468 | | - "version": "3.6.8" |
| 517 | + "version": "3.10.5" |
469 | 518 | } |
470 | 519 | }, |
471 | 520 | "nbformat": 4, |
|
0 commit comments