Skip to content

Commit

Permalink
attempt at adding crs
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-seaice committed Mar 20, 2024
1 parent bf58074 commit 386b73e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 5 deletions.
5 changes: 5 additions & 0 deletions grid_generation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CICE Grid Generation

These two scripts usign the 'esmgrids' package developed for ACCESS-OM2, to make the CICE grid files from the MOM super grid file.

As executing `python3 make_cice_grid.py` can fail on the login node, a shell script to use with pbs is provided. The shell script also captures the hh5 module used and the input files used. Run `qsub pbs_make_cice_grids.sh` to make the cice grids and kmt file at all 3 model resolutions.
2 changes: 1 addition & 1 deletion grid_generation/esmgrids
36 changes: 32 additions & 4 deletions grid_generation/make_cice_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Usage:
python make_cice_grid.py <ocean_hgrid> <ocean_hgrid>
- ocean_hgrid: Path to the MOM super grid NetCDF file.
- ocean_hgrid: Path to the corresponding hgrid NetCDF file.
- ocean_mask: Path to the corresponding mask NetCDF file.
"""

Expand Down Expand Up @@ -59,9 +59,37 @@ def main():
cice.grid_f.inputfile_md5 = md5sum(args.ocean_hgrid)
cice.grid_f.history_command = f"python make_CICE_grid.py {args.ocean_hgrid} {args.ocean_mask}"

crs = cice.grid_f.createVariable('crs', 'int')
crs.grid_mapping_name = "latitude_longitude"
# crs.crs_wkt = #TBA
#AS: based on https://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/ch05s06.html
crs = cice.grid_f.createVariable('tripolar', 'S1')
crs.grid_mapping_name = "tripolar_latitude_longitude"
crs.crs_wkt = """
GEOGCRS["WGS 84",
ENSEMBLE["World Geodetic System 1984 ensemble",
MEMBER["World Geodetic System 1984 (Transit)"],
MEMBER["World Geodetic System 1984 (G730)"],
MEMBER["World Geodetic System 1984 (G873)"],
MEMBER["World Geodetic System 1984 (G1150)"],
MEMBER["World Geodetic System 1984 (G1674)"],
MEMBER["World Geodetic System 1984 (G1762)"],
MEMBER["World Geodetic System 1984 (G2139)"],
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]],
ENSEMBLEACCURACY[2.0]],
PRIMEM["Greenwich",0,
ANGLEUNIT["radian",1]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["radian",1]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["radian",1]],
USAGE[
SCOPE["Horizontal component of 3D system."],
AREA["World."],
BBOX[-80,80,90,80]],
ID["EPSG",4326]]
"""

cice.write()

Expand Down
33 changes: 33 additions & 0 deletions grid_generation/pbs_make_cice_grids.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

#PBS -W umask=0022
#PBS -l mem=24gb
#PBS -l storage=gdata/ik11+gdata/tm70+gdata/hh5
#PBS -l wd
#PBS -j oe

umask 0003

module purge
module use /g/data/hh5/public/modules
module load conda/analysis3-23.10

echo "1 degree"
python3 make_cice_grid.py /g/data/ik11/inputs/access-om2/input_20201102/mom_1deg/ocean_hgrid.nc /g/data/ik11/inputs/access-om2/input_20201102/mom_1deg/ocean_mask.nc

mkdir 1deg
mv grid.nc kmt.nc 1deg


echo "0.25 deg"

python3 make_cice_grid.py /g/data/ik11/inputs/access-om2/input_20201102/mom_025deg/ocean_hgrid.nc /g/data/ik11/inputs/access-om2/input_20201102/mom_025deg/ocean_mask.nc

mkdir 025deg
mv grid.nc kmt.nc 025deg

echo "01 deg"
python3 make_cice_grid.py /g/data/ik11/inputs/access-om2/input_20201102/mom_01deg/ocean_hgrid.nc /g/data/ik11/inputs/access-om2/input_20201102/mom_01deg/ocean_mask.nc

mkdir 01deg
mv grid.nc kmt.nc 01deg

0 comments on commit 386b73e

Please sign in to comment.