Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add topo gen workflow #1

Merged
merged 15 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion README.md
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# make_OM3_025deg_topo
# make_OM3_025deg_topo

Make 0.25 degree topog.nc MOM bathymetry file from GEBCO 2024 dataset.

./gen_topog.sh will generate topography and associated files. For 0.25deg resolution and higher this will require qsub.

When the output files are to your satisfaction, commit and push your changes and add the git commit hash as metadata in the output .nc files by running finalise.sh.
18 changes: 18 additions & 0 deletions build.sh
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module load intel-compiler
anton-seaice marked this conversation as resolved.
Show resolved Hide resolved
module load netcdf

cd ./domain-tools/


# Check if the build directory exists before cleaning
if [ -d "build" ]; then
cmake --build build --target clean
fi

cmake -B build -DCMAKE_BUILD_TYPE=Release -DNetCDF_Fortran_LIBRARY=$NETCDF_ROOT/lib/Intel/libnetcdff.so -DNetCDF_C_LIBRARY=$NETCDF_ROOT/lib/libnetcdf.so -DNetCDF_Fortran_INCLUDE_DIRS=$NETCDF_ROOT/include/Intel
anton-seaice marked this conversation as resolved.
Show resolved Hide resolved

cmake --build build

cmake --install build --prefix=./

cd ../
2 changes: 1 addition & 1 deletion domain-tools
11 changes: 11 additions & 0 deletions edit_topog_new_fillfraction.txt
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
editTopo.py edits file version 1
#
# This file can be used as an argument for editTopo.py --apply
#
# created: Fri Nov 1 12:56:59 2024
# by: ek4684
# via: editTopo.py /g/data/tm70/ek4684/domain-tools/C-grid-workflow/fill_fraction_0.5/topog_new_fillfraction.nc --overwrite
#
# i j old new
1235 737 0.0 65.28469848632812
1227 734 0.0 56.118499755859375
26 changes: 26 additions & 0 deletions finalise.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env sh
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved
# Commit changes and push, then add metadata to note how changes were made

module load nco
module load git

echo "About to commit all changes to git repository and push to remote."
read -p "Proceed? (y/n) " yesno
case $yesno in
[Yy] ) ;;
* ) echo "Cancelled."; exit 0;;
esac

set -x
set -e

git commit -am "update" || true
git push || true

ncatted -O -h -a history,global,a,c," | Created on $(date) using https://github.com/ACCESS-NRI/make_OM3_025deg_topo/tree/$(git rev-parse --short HEAD)" topog.nc
ncatted -O -h -a history,global,a,c," | Updated on $(date) using https://github.com/ACCESS-NRI/make_OM3_025deg_topo/tree/$(git rev-parse --short HEAD)" ocean_mask.nc
ncatted -O -h -a history,global,a,c," | Created on $(date) using https://github.com/ACCESS-NRI/make_OM3_025deg_topo/tree/$(git rev-parse --short HEAD)" kmt.nc
ncatted -O -h -a history,global,a,c," | Updated on $(date) using https://github.com/ACCESS-NRI/make_OM3_025deg_topo/tree/$(git rev-parse --short HEAD)" ocean_vgrid.nc

ncatted -O -h -a history,global,a,c," and based on GEBCO_2024 topography" topog.nc

51 changes: 51 additions & 0 deletions gen_topo.sh
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env sh
#PBS -P tm70
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved
#PBS -q normal
#PBS -l walltime=4:00:00,mem=4GB
#PBS -l wd
#PBS -lstorage=gdata/hh5+gdata/ik11+gdata/tm70
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved

module use /g/data/hh5/public/modules
module load conda/analysis3

# Build domain-tools
./build.sh

set -x
set -e

cp -L --preserve=timestamps /g/data/tm70/ek4684/New_grid_input_files_025deg_75zlevels/ocean_hgrid.nc .
cp -L --preserve=timestamps /g/data/tm70/ek4684/New_grid_input_files_025deg_75zlevels/ocean_vgrid.nc .
ln -sf /g/data/ik11/inputs/GEBCO_2024/GEBCO_2024.nc ./
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved

# Convert double precision vgrid to single
./domain-tools/bin/float_vgrid --vgrid ocean_vgrid.nc --vgrid_type mom6
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved

# Interpolate topography on horizontal grid:
./domain-tools/bin/topogtools gen_topo -i GEBCO_2024.nc -o topog_new.nc --hgrid ocean_hgrid.nc --tripolar --longitude-offset -100
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved

# Cut off T cells of size less than 6kms (6000 m)
./domain-tools/bin/topogtools min_dy -i topog_new.nc -o topog_new_min_dy.nc --cutoff 6000 --hgrid ocean_hgrid.nc

# Fill cells that have a sea area fraction smaller than 0.5:
./domain-tools/bin/topogtools fill_fraction -i topog_new_min_dy.nc -o topog_new_fillfraction.nc --fraction 0.5

# edit_topo.py
python ./topogtools/editTopo.py --overwrite --nogui --apply edit_topog_new_fillfraction.txt --output topog_new_fillfraction_edited.nc topog_new_fillfraction.nc

# Remove seas:
./domain-tools/bin/topogtools deseas -i topog_new_fillfraction_edited.nc -o topog_new_fillfraction_edited_deseas.nc --grid_type C

# Set maximum/minimum depth
./domain-tools/bin/topogtools min_max_depth -i topog_new_fillfraction_edited_deseas.nc -o topog_new_fillfraction_edited_deseas_mindepth.nc --level 4 --vgrid ocean_vgrid.nc --vgrid_type mom6

# Create land/sea mask
cp topog_new_fillfraction_edited_deseas_mindepth.nc topog.nc
./domain-tools/bin/topogtools mask -i topog.nc -o ocean_mask.nc
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved
ncrename -O -v mask,kmt ocean_mask.nc kmt.nc
anton-seaice marked this conversation as resolved.
Show resolved Hide resolved
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved

# Create ESMF mesh from hgrid and ocean_mask.nc
python3 ./om3-scripts/mesh_generation/generate_mesh.py --grid-type=mom --grid-filename=ocean_hgrid.nc --mesh-filename=access-om2-025deg-ESMFmesh.nc --mask-filename=ocean_mask.nc --wrap-lons

# Create ESMF mesh without mask
python3 ./om3-scripts/mesh_generation/generate_mesh.py --grid-type=mom --grid-filename=ocean_hgrid.nc --mesh-filename=access-om2-025deg-nomask-ESMFmesh.nc --wrap-lons
ezhilsabareesh8 marked this conversation as resolved.
Show resolved Hide resolved