# Make a grid similar to Example 3 using FRE-NCtools
# instead of gridtools for comparison.
# Still need to use gridtools to create the
# subsetted GEBCO grid for creating ocean_topog.nc
make_hgrid --grid_type regular_lonlat_grid\
--nxbnds 2 --nybnds 2 --xbnds -140,-120 --ybnds 25,55\
--nlon 40 --nlat 60
# Ocean and Atmosphere are on the same grid, copy them
cp horizontal_grid.nc ocean_hgrid.nc
cp horizontal_grid.nc atmos_hgrid.nc
# Create solo mosaic files
make_solo_mosaic --num_tiles 1 --dir ./ --mosaic_name ocean_mosaic --tile_file ocean_hgrid.nc
make_solo_mosaic --num_tiles 1 --dir ./ --mosaic_name atmos_mosaic --tile_file atmos_hgrid.nc
# A vertical grid needs to exist to run make_topog
# This is an arbitrary vertical grid taken from another example. The
# selection of bounds here do not necessarily make sense for this domain!
make_vgrid \
--nbnds 3 \
--bnds 0.,220.,5500. \
--dbnds 10.,10.,367.14286 \
--center c_cell \
--grid_name ocean_vgrid
# Use the ocean_mosaic to create a topography
#mpirun -np 4 --oversubscribe make_topog_parallel\
make_topog\
--verbose \
--mosaic ocean_mosaic.nc --topog_type realistic \
--scale_factor -1 \
--vgrid ocean_vgrid.nc \
--output ocean_topog.nc \
--topog_file /home/cermak/workdir/bathy/gebco/GEBCO_Ex3_subset.nc \
--topog_field elevation
# Create exchange files with ocean_mask.nc and land_mask.nc
# This might be run within a new INPUT directory as it copies files into that
# directory.
# make_quick_mosaic --input_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc
# make_coupler_mosaic
# make_coupler_mosaic --atmos_mosaic atmos_mosaic.nc --ocean_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc
netcdf ocean_mask_quick {
dimensions:
nx = 20 ;
ny = 30 ;
variables:
double mask(ny, nx) ;
mask:standard_name = "ocean fraction at T-cell centers" ;
mask:units = "none" ;
// global attributes:
:grid_version = "0.2" ;
:code_version = "$Name: $" ;
:history = "make_quick_mosaic --input_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc" ;
data:
m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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ;
}
netcdf ocean_mask_coupler {
dimensions:
nx = 20 ;
ny = 30 ;
variables:
double mask(ny, nx) ;
mask:standard_name = "ocean fraction at T-cell centers" ;
mask:units = "none" ;
double areaO(ny, nx) ;
areaO:standard_name = "ocean grid area" ;
areaO:units = "none" ;
double areaX(ny, nx) ;
areaX:standard_name = "ocean exchange grid area" ;
areaX:units = "none" ;
// global attributes:
:grid_version = "0.2" ;
:code_version = "$Name: fre-nctools-bronx-10 $" ;
:history =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, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ;
areaO =
11159704157.3006, 11159704157.3009, 11159704157.3006, 11159704157.3006,
11159704157.3009, 11159704157.3006, 11159704157.3009, 11159704157.3006,
make_hgrid --grid_type tripolar_grid --nxbnd 2 --nybnd 2 --xbnd -280,80 --ybnd -85,90 --nlon 144 --nlat 70 --grid_name ocean_hgrid --center c_cell
make_hgrid --grid_type tripolar_grid --nxbnd 2 --nybnd 2 --xbnd -280,80 --ybnd -85,90 --nlon 144 --nlat 70 --grid_name ocean_hgrid --center c_cell
cp ocean_hgrid.nc atmos_hgrid.nc
make_solo_mosaic --num_tiles 1 --dir ./ --mosaic_name ocean_mosaic --tile_file ocean_hgrid.nc
make_solo_mosaic --num_tiles 1 --dir ./ --mosaic_name atmos_mosaic --tile_file atmos_hgrid.nc
make_topog --mosaic ocean_mosaic.nc --topog_file OCCAM_p5degree.nc --topog_field TOPO --scale_factor -1 --output ocean_topog.nc --filter_topog
make_quick_mosaic --input_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc
mv ocean_mask.nc ocean_mask_quick.nc
make_coupler_mosaic --atmos_mosaic atmos_mosaic.nc --ocean_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc
mv ocean_mask.nc ocean_mask_coupler.nc
netcdf ocean_mask_quick {
dimensions:
nx = 72 ;
ny = 35 ;
variables:
double mask(ny, nx) ;
mask:standard_name = "ocean fraction at T-cell centers" ;
mask:units = "none" ;
// global attributes:
:grid_version = "0.2" ;
:code_version = "$Name: $" ;
:history = "make_quick_mosaic --input_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc" ;
data:
mask =
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, 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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
netcdf ocean_mask_coupler {
dimensions:
nx = 72 ;
ny = 35 ;
variables:
double mask(ny, nx) ;
mask:standard_name = "ocean fraction at T-cell centers" ;
mask:units = "none" ;
double areaO(ny, nx) ;
areaO:standard_name = "ocean grid area" ;
areaO:units = "none" ;
double areaX(ny, nx) ;
areaX:standard_name = "ocean exchange grid area" ;
areaX:units = "none" ;
// global attributes:
:grid_version = "0.2" ;
:code_version = "$Name: fre-nctools-bronx-10 $" ;
:history = "make_coupler_mosaic --atmos_mosaic atmos_mosaic.nc --ocean_mosaic ocean_mosaic.nc --ocean_topog ocean_topog.nc" ;
data:
mask =
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, 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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
netcdf ocean_mask_coupler {
dimensions:
nx = 72 ;
ny = 35 ;
variables:
double mask(ny, nx) ;
mask:standard_name = "ocean fraction at T-cell centers" ;
mask:units = "none" ;
double areaO(ny, nx) ;
areaO:standard_name = "ocean grid area" ;
areaO:units = "none" ;
double areaX(ny, nx) ;
areaX:standard_name = "ocean exchange grid area" ;
areaX:units = "none" ;
// global attributes:
:grid_version = "0.2" ;
:code_version = "$Name: fre-nctools-bronx-10 $" ;
:history = "make_coupler_mosaic --atmos_mosaic C48_mosaic.nc --ocean_mosaic ocean_mosaic.nc --mosaic_name mosaic --ocean_topog ocean_topog.nc --mosaic_name grid_spec" ;
data:
mask =
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, 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, 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, 1.00000000000002,
0.999999999999996, 1.00000000000008, 0.999999999999885,
0.999999999999917, 1.00000000000017, 0.999999999999883, 1.00000000000012,
0.999999999999924, 0.999999999999904, 0.999999999999901, 1.0000000000001,
Ohh Yeah got it. Its the default refinement factor =2I was going through above steps and trying to reproduce the files.
Noticed that the make_topog and the remaining steps gives HALF the resolution of input ocean_hgrid file
Is there any specific reason for that? the topog file looks too coarse.
Dear sir,Yes, I have seen make_topog work without a vgrid file.
Using GEBCO, I run into similar problems as seen in Does make_topog need MAXXGRID, nthreads? · Issue #35 · NOAA-GFDL/FRE-NCtools. No matter what value I provide for MAXXGRID or the number of processors or machine size, make_topog does not work. It works with no changes if I provide a vgrid file. For our purposes, we can ignore the auxiliary information that is generated with respect to the vgrid file. We just need the diagnosed topography file at this point for comparison.
So, using OCCAM_p5degree.nc with the example grid, does the ocean_mask behave in both programs? Or do you still see round off error?
Yes, I had tried the same. but i am getting segmentation fault (core dumped), please note that i am working on my laptop. Anyhelp regarding this is greatly appreciated.I followed the following page and solved my problem.
![]()
Does make_topog need MAXXGRID, nthreads? · Issue #35 · NOAA-GFDL/FRE-NCtools
Is your question related to a problem? Please describe. I am trying to generate a topography: make_topog --mosaic ocean_mosaic.nc \ --topog_type realistic \ --topog_file ${topo_file} \ --topog_fiel...github.com
You have to recompile the FRE-NCtools by modifying the values for MAXXGRID to a higher value in FRE-NCtools/tools/libfrencutils/create_xgrid.h file.
May be as @cermak suggested, use ocean_vgrid.nc while creating ocean_topog.nc file may also solve the problem.
Cheers
Thank you, i bumped the MAXXGRID to 1e8 and now it's working. earlier i put 1e10 and that was causing the segmentation fault.I followed the following page and solved my problem.
![]()
Does make_topog need MAXXGRID, nthreads? · Issue #35 · NOAA-GFDL/FRE-NCtools
Is your question related to a problem? Please describe. I am trying to generate a topography: make_topog --mosaic ocean_mosaic.nc \ --topog_type realistic \ --topog_file ${topo_file} \ --topog_fiel...github.com
You have to recompile the FRE-NCtools by modifying the values for MAXXGRID to a higher value in FRE-NCtools/tools/libfrencutils/create_xgrid.h file.
May be as @cermak suggested, use ocean_vgrid.nc while creating ocean_topog.nc file may also solve the problem.
Cheers
Could you please provide some clarification on this?. It might sound trivial but i have few doubts.Note that MOM6 proper does not actually read the mask file. It figures out the mask based on ocean_topog.nc and MASKING_DEPTH. Still, other components might read it.