-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add notebook exploring zuno_rmm data
- Loading branch information
Showing
2 changed files
with
218 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,218 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"\u001b[32m\u001b[1m Activating\u001b[22m\u001b[39m project at `~/src_nobackup/particles.jl.git_3dflow`\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"# Initialize the notebook\n", | ||
"using Pkg\n", | ||
"Pkg.activate(\"..\")\n", | ||
"#include(\"../src/Particles.jl\")\n", | ||
"using Particles\n", | ||
"using Plots\n", | ||
"using Zarr\n", | ||
"using ZipFile\n", | ||
"\n", | ||
"nothing" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"Zarr_data = ZarrData(\".\",\"ZUNORMM_map_fullgrid.zarr\")\n", | ||
"t0=get_reftime(Zarr_data)\n", | ||
"h=initialize_interpolation(Zarr_data,\"waterlevel\",t0)\n", | ||
"u=initialize_interpolation(Zarr_data,\"x_velocity\",t0)\n", | ||
"v=initialize_interpolation(Zarr_data,\"y_velocity\",t0)\n", | ||
"s=initialize_interpolation(Zarr_data,\"salinity\",t0)\n", | ||
"\n", | ||
"nothing" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 53, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"bbox=[3.4773802907221345, 5.566420993890162, 51.66065856527758, 52.466444933890344]\n" | ||
] | ||
}, | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"(Dates.DateTime(\"2022-04-16T00:00:00\"), 2.0, 14.916666666666666)" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"# find the extent of the data\n", | ||
"xy_bbox=Zarr_data.xy_grid.bbox\n", | ||
"println(\"bbox=$(xy_bbox)\") #bbox=[3.4773802907221345, 5.566420993890162, 51.66065856527758, 52.466444933890344]\n", | ||
"\n", | ||
"#z0=Zarr_data.z_iface_3d[:,:,:,1]\n", | ||
"#z0[z0.<-9990].=0.0\n", | ||
"#minz = minimum(z0) #scaled\n", | ||
"#println(\"minz=$(minz)\")\n", | ||
"#maxx = maximum(x)\n", | ||
"#minx,\n", | ||
"#z[1,1,:,1]\n", | ||
"size(z)\n", | ||
"#z0[:,:,30]\n", | ||
"#z0=Zarr_data.Variables[\"z_iface_3d\"][:,:,:,1]\n", | ||
"z0=Zarr_data.file.arrays[\"z_iface_3d\"][:,:,:,1]\n", | ||
"z0_scaled=0.01*z0\n", | ||
"z0_scaled[z0.<-9990].=0.0\n", | ||
"z0_min=minimum(z0_scaled,dims=3)\n", | ||
"z0_min\n", | ||
"heatmap(z0_min[:,:,1]')\n", | ||
"#Zarr_data.file.arrays[\"z_iface_3d\"].attrs\n", | ||
"t=Zarr_data.file.arrays[\"time\"][:] #\"seconds since 2022-04-01 00:00:00 +00:00\"\n", | ||
"t0,(t[2]-t[1])/3600.0, (t[end]-t[2])/3600.0/24.0 #2022-04-16 step=2hrs until 2022-05-01" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 60, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"x_left = 3.4\n", | ||
"x_right = 5.6\n", | ||
"y_bot = 51.6\n", | ||
"y_top = 52.5\n", | ||
"z_surface = 0.0\n", | ||
"z_bottom = -40.0\n", | ||
"t_start=0.0\n", | ||
"t_step=2*3600.0\n", | ||
"#t_stop=15*24*3600.0 # 15 days\n", | ||
"t_stop=4*3600.0 # 4 hours\n", | ||
"\n", | ||
"anim = @animate for t in range(t_start, stop = t_stop, step = t_step)\n", | ||
" if t%1200==0 print(\"t=$(t) \") end\n", | ||
" # grid for plotting only\n", | ||
" x_points = range(x_left,stop=x_right,length=100)\n", | ||
" y_points = range(y_bot,stop=y_top,length=100)\n", | ||
" z = -2.0\n", | ||
" #u_interp = [u(x,y_middle,z,t) for x in x_points, z in z_points] # x velocity\n", | ||
" h_interp = [h(x,y,z,t) for x in x_points, y in y_points] # water level\n", | ||
" s_interp = [s(x,y,z,t) for x in x_points, y in y_points] # salinity\n", | ||
"\n", | ||
" l = @layout([a; b])\n", | ||
" p1=heatmap(x_points,y_points,h_interp',xlabel=\"x\",ylabel=\"y\",title=\"waterlevel=$(t)\",clims=(-1.5,1.5))\n", | ||
" p2=heatmap(x_points,y_points,s_interp',xlabel=\"x\",ylabel=\"y\",title=\"salinity\",clims=(0,20))\n", | ||
" plot(p1,p2,layout=l,size=(800,400))\n", | ||
"end\n", | ||
"\n", | ||
"gif(anim, \"./rmm.gif\", fps = 3)\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 58, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"100×100 Matrix{Float64}:\n", | ||
" 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 … 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n", | ||
" 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n", | ||
" 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0\n", | ||
" 0.0 0.0 0.0 0.0 0.0 0.0 0.0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 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
} | ||
], | ||
"source": [ | ||
"x_left = 3.4\n", | ||
"x_right = 5.6\n", | ||
"y_bot = 51.6\n", | ||
"y_top = 52.5\n", | ||
"z_surface = 0.0\n", | ||
"z_bottom = -40.0\n", | ||
"t_start=0.0\n", | ||
"t_step=2*3600.0\n", | ||
"#t_stop=15*24*3600.0 # 15 days\n", | ||
"t_stop=4*3600.0 # 4 hours\n", | ||
"\n", | ||
"t=t_stop\n", | ||
"\n", | ||
"# grid for plotting only\n", | ||
"x_points = range(x_left,stop=x_right,length=100)\n", | ||
"y_points = range(z_bottom,stop=z_surface,length=100)\n", | ||
"z = -2.0\n", | ||
"#u_interp = [u(x,y_middle,z,t) for x in x_points, z in z_points] # x velocity\n", | ||
"h_interp = [h(x,y,z,t) for x in x_points, y in y_points] # water level\n", | ||
"s_interp = [s(x,y,z,t) for x in x_points, y in y_points] # salinity\n", | ||
"\n", | ||
"h_interp\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Julia 1.9.2", | ||
"language": "julia", | ||
"name": "julia-1.9" | ||
}, | ||
"language_info": { | ||
"file_extension": ".jl", | ||
"mimetype": "application/julia", | ||
"name": "julia", | ||
"version": "1.9.2" | ||
}, | ||
"orig_nbformat": 4, | ||
"vscode": { | ||
"interpreter": { | ||
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1" | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |