{ "cells": [ { "cell_type": "markdown", "id": "bd5e97dc-38b9-4f96-9129-a9e9af845739", "metadata": {}, "source": [ "# Running MITgcm from Julia\n", "\n", "- In this notebook, we just show the method for running a small MITgcm verification experiment via testreport. \n", "- A more general method is highlighted in the [MITgcm.jl docs](https://gaelforget.github.io/MITgcm.jl/dev/)." ] }, { "cell_type": "code", "execution_count": 2, "id": "e44c0df4-2437-4c4b-a325-1502c998493e", "metadata": {}, "outputs": [], "source": [ "#Let's start a temporary environment for this notebook, and add julia packages that we will use :\n", "if !isdefined(Main,:MITgcm)\n", " using Pkg; Pkg.activate(temp=true); Pkg.add(\"MITgcm\")\n", "end\n", "using MITgcm" ] }, { "cell_type": "markdown", "id": "8fe62e70-2815-45ef-a147-6030f67f0fd8", "metadata": {}, "source": [ "## Setting up an optfile\n", "\n", "In jupyter, it seems that the MITgcm build options file needs to be explicitely selected; e.g. darwin_arm64_gfortran in MacOS (M series). " ] }, { "cell_type": "code", "execution_count": 3, "id": "70ad385e-226d-4029-a7f7-4e55c7c9faaa", "metadata": {}, "outputs": [], "source": [ "path0=MITgcm.default_path()\n", "MC=MITgcm_config(configuration=\"flt_example\")\n", "a=MITgcm.build_options_default[1]*\" -optfile=../../../tools/build_options/darwin_arm64_gfortran\"\n", "b=\"-optfile=../../../\"\n", "!occursin(b,a) ? opt=\"\" : opt=\"-optfile=\"*joinpath(path0,split(a,b)[2]);" ] }, { "cell_type": "markdown", "id": "9c790d06-6d1f-4ed8-a3b5-3124f29e892b", "metadata": {}, "source": [ "## Running a Verification Experiment" ] }, { "cell_type": "code", "execution_count": 4, "id": "fe55d3c3-a720-4abc-9e0d-4a2af0c696da", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/private/var/folders/vn/3r695jqd3177cw09wdmf3z940000gn/T/jl_shUVQf2F8b\n" ] } ], "source": [ "tmp=testreport(MC,opt);" ] }, { "cell_type": "markdown", "id": "013b01e2-6fec-446a-8636-769fd11ab1d6", "metadata": {}, "source": [ "## Look at Model Ouput\n", "\n", "In this case we the particle tracking output from `MITgcm/pkg/flt`. All other MITgcm output formats are supported by [MITgcm.jl docs](https://gaelforget.github.io/MITgcm.jl/dev/)." ] }, { "cell_type": "code", "execution_count": 5, "id": "864f57e6-56f5-462b-9b47-dfa44934b1ca", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
420×14 DataFrame
395 rows omitted
RowIDtimelonlatdepijketaNuVelvVelthetasalttile
Int64Int64Float32Float32Float32Float32Float32Float32Float32Float32Float32Float32Float32Int64
113600117500.097500.4-2531.2524.020.00015.00.0001088532.28572e-50.000293337-0.099547135.01
223600137500.097500.5-2531.2528.020.00015.00.0001257951.72759e-50.00031245-0.099547335.01
333600167500.097500.6-2531.2534.020.00015.00.000176366-6.00037e-60.000392465-0.09954835.01
4213600117500.097500.4-2531.2524.020.00015.00.0001088532.28572e-50.000293337-0.099547135.01
5223600137500.097500.5-2531.2528.020.00015.00.0001257951.72759e-50.00031245-0.099547335.01
6233600167500.097500.6-2531.2534.020.00015.00.000176366-6.00037e-60.000392465-0.09954835.01
7413600117500.097500.0-2531.2524.020.05.0-999.0-999.0-999.0-999.0-999.01
8423600137500.097500.0-2531.2528.020.05.0-999.0-999.0-999.0-999.0-999.01
9433600167500.097500.0-2531.2534.020.05.0-999.0-999.0-999.0-999.0-999.01
10613600117500.097500.0-2531.2524.020.05.0-999.0-999.0-999.0-999.0-999.01
11623600137500.097500.0-2531.2528.020.05.0-999.0-999.0-999.0-999.0-999.01
12633600167500.097500.0-2531.2534.020.05.0-999.0-999.0-999.0-999.0-999.01
1381360097500.097500.0-1968.7520.020.04.09.8633e-52.56849e-50.0002845890.099548535.01
409102108002.0e51.59998e5-1406.2540.500132.49963.0-0.002285789.15741e-5-0.0004808710.29835335.04
410124108002.70001e51.25009e5-3093.7554.500325.50176.0-0.001469350.0004682650.00208892-0.29869235.04
41112510800270001.01.30008e5-3093.7554.500226.50156.0-0.00166410.0003875490.00187627-0.29870435.04
412126108002.70001e51.35007e5-3093.7554.500127.50136.0-0.00183510.000304530.00163208-0.29871735.04
413127108002.7e51.40006e5-3093.7554.500128.50116.0-0.001979780.0002185320.00135935-0.2987335.04
414128108002.7e51.45004e5-3093.7554.529.50096.0-0.002095740.0001283510.00106042-0.29874335.04
415129108002.7e51.50003e5-3093.7554.530.50066.0-0.002180693.25459e-50.000736987-0.29875535.04
416130108002.7e51.55002e5-3093.7554.499931.50036.0-0.00223241-7.02949e-50.000390125-0.29876735.04
417120108002.70002e51.0501e5-3093.7554.500521.50216.0-0.0005140930.0007517990.00255706-0.29864335.04
418121108002.70002e51.1001e5-3093.7554.500422.5026.0-0.0007723930.0006905380.00250338-0.29865535.04
419122108002.70002e51.1501e5-3093.7554.500423.5026.0-0.001020190.0006212790.00240577-0.29866735.04
420123108002.70002e51.20009e5-3093.7554.500324.50186.0-0.001253660.0005465350.00226656-0.29867935.04
" ], "text/latex": [ "\\begin{tabular}{r|cccccccccc}\n", "\t& ID & time & lon & lat & dep & i & j & k & etaN & \\\\\n", "\t\\hline\n", "\t& Int64 & Int64 & Float32 & Float32 & Float32 & Float32 & Float32 & Float32 & Float32 & \\\\\n", "\t\\hline\n", "\t1 & 1 & 3600 & 117500.0 & 97500.4 & -2531.25 & 24.0 & 20.0001 & 5.0 & 0.000108853 & $\\dots$ \\\\\n", "\t2 & 2 & 3600 & 137500.0 & 97500.5 & -2531.25 & 28.0 & 20.0001 & 5.0 & 0.000125795 & $\\dots$ \\\\\n", "\t3 & 3 & 3600 & 167500.0 & 97500.6 & -2531.25 & 34.0 & 20.0001 & 5.0 & 0.000176366 & $\\dots$ \\\\\n", "\t4 & 21 & 3600 & 117500.0 & 97500.4 & -2531.25 & 24.0 & 20.0001 & 5.0 & 0.000108853 & $\\dots$ \\\\\n", "\t5 & 22 & 3600 & 137500.0 & 97500.5 & -2531.25 & 28.0 & 20.0001 & 5.0 & 0.000125795 & $\\dots$ \\\\\n", "\t6 & 23 & 3600 & 167500.0 & 97500.6 & -2531.25 & 34.0 & 20.0001 & 5.0 & 0.000176366 & $\\dots$ \\\\\n", "\t7 & 41 & 3600 & 117500.0 & 97500.0 & -2531.25 & 24.0 & 20.0 & 5.0 & -999.0 & $\\dots$ \\\\\n", "\t8 & 42 & 3600 & 137500.0 & 97500.0 & -2531.25 & 28.0 & 20.0 & 5.0 & -999.0 & $\\dots$ \\\\\n", "\t9 & 43 & 3600 & 167500.0 & 97500.0 & -2531.25 & 34.0 & 20.0 & 5.0 & -999.0 & $\\dots$ \\\\\n", "\t10 & 61 & 3600 & 117500.0 & 97500.0 & -2531.25 & 24.0 & 20.0 & 5.0 & -999.0 & $\\dots$ \\\\\n", "\t11 & 62 & 3600 & 137500.0 & 97500.0 & -2531.25 & 28.0 & 20.0 & 5.0 & -999.0 & $\\dots$ \\\\\n", "\t12 & 63 & 3600 & 167500.0 & 97500.0 & -2531.25 & 34.0 & 20.0 & 5.0 & -999.0 & $\\dots$ \\\\\n", "\t13 & 81 & 3600 & 97500.0 & 97500.0 & -1968.75 & 20.0 & 20.0 & 4.0 & 9.8633e-5 & $\\dots$ \\\\\n", "\t14 & 87 & 3600 & 1.97582e5 & 17489.2 & -281.25 & 40.0164 & 3.99783 & 1.0 & 0.0004626 & $\\dots$ \\\\\n", "\t15 & 88 & 3600 & 1.97593e5 & 27488.0 & -281.25 & 40.0185 & 5.9976 & 1.0 & 0.00059785 & $\\dots$ \\\\\n", "\t16 & 89 & 3600 & 1.97602e5 & 37486.9 & -281.25 & 40.0205 & 7.99738 & 1.0 & 0.000678877 & $\\dots$ \\\\\n", "\t17 & 90 & 3600 & 1.97611e5 & 47486.0 & -281.25 & 40.0222 & 9.99719 & 1.0 & 0.000713496 & $\\dots$ \\\\\n", "\t18 & 91 & 3600 & 197618.0 & 57485.2 & -281.25 & 40.0236 & 11.997 & 1.0 & 0.000708864 & $\\dots$ \\\\\n", "\t19 & 131 & 3600 & 42606.7 & 42486.5 & -281.276 & 9.02135 & 8.9973 & 1.00005 & 0.000601827 & $\\dots$ \\\\\n", "\t20 & 132 & 3600 & 42553.4 & 42493.3 & -562.552 & 9.01067 & 8.99865 & 1.50009 & 0.000601823 & $\\dots$ \\\\\n", "\t21 & 133 & 3600 & 42500.0 & 42500.0 & -843.798 & 9.0 & 9.0 & 2.00009 & 0.000601819 & $\\dots$ \\\\\n", "\t22 & 134 & 3600 & 42500.0 & 42500.0 & -1125.04 & 9.0 & 9.0 & 2.50008 & 0.000601819 & $\\dots$ \\\\\n", "\t23 & 135 & 3600 & 42500.0 & 42500.0 & -1406.29 & 9.0 & 9.0 & 3.00007 & 0.000601819 & $\\dots$ \\\\\n", "\t24 & 136 & 3600 & 42500.0 & 42500.0 & -1687.54 & 9.0 & 9.0 & 3.50007 & 0.000601819 & $\\dots$ \\\\\n", "\t25 & 137 & 3600 & 42500.0 & 42500.0 & -1968.78 & 9.0 & 9.0 & 4.00006 & 0.000601819 & $\\dots$ \\\\\n", "\t26 & 138 & 3600 & 42500.0 & 42500.0 & -2250.03 & 9.0 & 9.0 & 4.50005 & 0.000601819 & $\\dots$ \\\\\n", "\t27 & 139 & 3600 & 42500.0 & 42500.0 & -2531.28 & 9.0 & 9.0 & 5.00005 & 0.000601819 & $\\dots$ \\\\\n", "\t28 & 140 & 3600 & 42500.0 & 42500.0 & -2812.52 & 9.0 & 9.0 & 5.50004 & 0.000601819 & $\\dots$ \\\\\n", "\t29 & 6 & 3600 & 97500.0 & 1.075e5 & -2531.25 & 20.0 & 22.0001 & 5.0 & -5.52355e-5 & $\\dots$ \\\\\n", "\t30 & 7 & 3600 & 107500.0 & 1.075e5 & -2531.25 & 22.0 & 22.0001 & 5.0 & -5.26708e-5 & $\\dots$ \\\\\n", "\t$\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & $\\dots$ & \\\\\n", "\\end{tabular}\n" ], "text/plain": [ "\u001b[1m420×14 DataFrame\u001b[0m\n", "\u001b[1m Row \u001b[0m│\u001b[1m ID \u001b[0m\u001b[1m time \u001b[0m\u001b[1m lon \u001b[0m\u001b[1m lat \u001b[0m\u001b[1m dep \u001b[0m\u001b[1m i \u001b[0m\u001b[1m j \u001b[0m ⋯\n", " │\u001b[90m Int64 \u001b[0m\u001b[90m Int64 \u001b[0m\u001b[90m Float32 \u001b[0m\u001b[90m Float32 \u001b[0m\u001b[90m Float32 \u001b[0m\u001b[90m Float32 \u001b[0m\u001b[90m Float32\u001b[0m ⋯\n", "─────┼──────────────────────────────────────────────────────────────────────────\n", " 1 │ 1 3600 117500.0 97500.4 -2531.25 24.0 20.0001 ⋯\n", " 2 │ 2 3600 137500.0 97500.5 -2531.25 28.0 20.0001\n", " 3 │ 3 3600 167500.0 97500.6 -2531.25 34.0 20.0001\n", " 4 │ 21 3600 117500.0 97500.4 -2531.25 24.0 20.0001\n", " 5 │ 22 3600 137500.0 97500.5 -2531.25 28.0 20.0001 ⋯\n", " 6 │ 23 3600 167500.0 97500.6 -2531.25 34.0 20.0001\n", " 7 │ 41 3600 117500.0 97500.0 -2531.25 24.0 20.0\n", " 8 │ 42 3600 137500.0 97500.0 -2531.25 28.0 20.0\n", " 9 │ 43 3600 167500.0 97500.0 -2531.25 34.0 20.0 ⋯\n", " 10 │ 61 3600 117500.0 97500.0 -2531.25 24.0 20.0\n", " 11 │ 62 3600 137500.0 97500.0 -2531.25 28.0 20.0\n", " ⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱\n", " 411 │ 125 10800 270001.0 1.30008e5 -3093.75 54.5002 26.5015\n", " 412 │ 126 10800 2.70001e5 1.35007e5 -3093.75 54.5001 27.5013 ⋯\n", " 413 │ 127 10800 2.7e5 1.40006e5 -3093.75 54.5001 28.5011\n", " 414 │ 128 10800 2.7e5 1.45004e5 -3093.75 54.5 29.5009\n", " 415 │ 129 10800 2.7e5 1.50003e5 -3093.75 54.5 30.5006\n", " 416 │ 130 10800 2.7e5 1.55002e5 -3093.75 54.4999 31.5003 ⋯\n", " 417 │ 120 10800 2.70002e5 1.0501e5 -3093.75 54.5005 21.5021\n", " 418 │ 121 10800 2.70002e5 1.1001e5 -3093.75 54.5004 22.502\n", " 419 │ 122 10800 2.70002e5 1.1501e5 -3093.75 54.5004 23.502\n", " 420 │ 123 10800 2.70002e5 1.20009e5 -3093.75 54.5003 24.5018 ⋯\n", "\u001b[36m 8 columns and 399 rows omitted\u001b[0m" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pth=joinpath(tmp,\"MITgcm\",\"verification\",\"flt_example\",\"run\")\n", "tmp=read_flt(pth,Float32)" ] }, { "cell_type": "code", "execution_count": null, "id": "7c578975-0c8e-49a7-bf55-f70350ddc812", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Julia 1.10.5", "language": "julia", "name": "julia-1.10" }, "language_info": { "file_extension": ".jl", "mimetype": "application/julia", "name": "julia", "version": "1.10.5" } }, "nbformat": 4, "nbformat_minor": 5 }