Atmospheric Forcing

NEMO includes a CORE bulk formulae interface that allows the CGRF Dataset to be used as atmospheric forcing (aka surface boundary conditions; SBC). The namelist that controls that is namsbc_core. That NEMO interface requires that all of the files (including the Interpolation Weights) be in a single directory and have a prescribed name pattern. To satisfy that requirement the following file management strategy has been established:

  • The Salish Sea MEOPAR repository of CGRF product files and their NEMO CORE bulk interface representation reside in /ocean/dlatorne/MEOPAR/CGRF/

  • Within that directory is 1 sub-directory:

    • NEMO-atmos/ is a collection of CGRF files using the names required by the NEMO CORE bulk interface. The NEMO-atmos/ directory also contains symbolic links to the Interpolation Weights file and the No-Snow Constraint file in the grid repo.

  • The files in the /ocean/dlatorne/MEOPAR/CGRF/ directory are managed by the salishsea get_cgrf tool.

  • The namelist that directs NEMO to use the files in NEMO-atmos/ looks like:

    !-----------------------------------------------------------------------
    &namsbc_core   !   namsbc_core  CORE bulk formulae
    !-----------------------------------------------------------------------
    !        !  file name  ! freq (hr)  ! variable  !  time   !  clim  ! period ! weights             ! rotation !
    !        !             ! (<0 == mo) !   name    ! interp  !  (T/F) !        ! filename            ! pairing  !
      sn_wndi = 'u10',       1,          'u_wind',    .true.,  .false., 'daily', 'met_gem_weight.nc',  'Uwnd'
      sn_wndj = 'v10',       1,          'v_wind',    .true.,  .false., 'daily', 'met_gem_weight.nc',  'Vwnd'
      sn_qsr  = 'qsw',       1,          'solar',     .true.,  .false., 'daily', 'met_gem_weight.nc',  ''
      sn_qlw  = 'qlw',       1,          'therm_rad', .true.,  .false., 'daily', 'met_gem_weight.nc',  ''
      sn_tair = 't2',        1,          'tair',      .true.,  .false., 'daily', 'met_gem_weight.nc',  ''
      sn_humi = 'q2',        1,          'qair',      .true.,  .false., 'daily', 'met_gem_weight.nc',  ''
      sn_prec = 'precip',    1,          'precip',    .true.,  .false., 'daily', 'met_gem_weight.nc',  ''
      sn_snow = 'no_snow', -12,          'snow',      .false., .true.,  'yearly','met_gem_weight.nc',  ''
    
      cn_dir      = 'NEMO-atmos/'  ! root directory for the location of the bulk files
      ln_2m       = .true.         ! air temperature and humidity referenced at 2m (T) instead 10m (F)
    /
    

    The file name roots and the variable names come from the CGRF files.

  • The directory given in as value associated with the atmospheric key in the forcing section of the run description file is symlinked as NEMO-atmos in the run directory to complete the chain from the namelist to the CGRF products files:

    forcing:
      atmospheric: /ocean/dlatorne/MEOPAR/CGRF/NEMO-atmos/
    

No-Snow Constraint

The NEMO CORE bulk interface requires a snow file but it has been decided to impose a constraint on the Salish Sea model whereby all precipitation falls in liquid phase. That constraint is provided by the no_snow.nc file in the grid repo. That file ensures that the solid phase precipitation is zero at all times and locations. It is used as annual climatology forcing in the namsbc_core name list.

Interpolation Weights

JP Paquin created a weights file that allows NEMO’s Interpolation On the Fly (IOF) feature to be used to take atmospheric forcing values from the CGRF Dataset. It is in the 4_weights_ATMOS/ directory of the 2-Oct-2013 WC3_PREP tarball and has been added to the grid/ of the NEMO-forcing repo. Those weight values were subsequently used to create a netCDF4 weights file with zlib compression enabled and CF-1.6 conventions compliant attributes using the I_ForcingFiles/Atmos/netCDF4weights-CGRF.ipynb notebook.

Creating New Weights Files

The NEMO_Preparation/4_weights_ATMOS/get_weight_nemo program in the NEMO_EastCoast repo can be used in conjunction with a bathymetry file and atmospheric forcing file(s) to create a weights file that allows NEMO’s Interpolation On the Fly (IOF) feature to use the atmospheric forcing values. An example of the use of get_weight_nemo to create a weights file for datasets from the operational West deployment of Environment Canada’s High Resolution Deterministic Prediction System (HRDPS) is presented here:

Clone the NEMO_EastCoast repo on salish and edit the NEMO_Preparation/4_weights_ATMOS/make.sh file to comment out the default build commands and enable the salish ones:

#- On salish (UBC)
LIBNETCDF=/usr
mpif90 -c grid.f90 -I${LIBNETCDF}/include -L${LIBNETCDF}/lib -lnetcdf
mpif90 -c map.F90 -I${LIBNETCDF}/include -L${LIBNETCDF}/lib -lnetcdf
mpif90 -c get_weight_nemo.F90 -I${LIBNETCDF}/include -L${LIBNETCDF}/lib -lnetcdf
mpif90 -o get_weight_nemo get_weight_nemo.o map.o grid.o -I${LIBNETCDF}/include -L${LIBNETCDF}/lib -lnetcdf -lnetcdff

Build get_weight_nemo:

$ ./make.sh

get_weight_nemo creates a file of weighting factors that allow atmospheric forcing variable values on one grid to be interpolated on to the model grid (as defined in the bathymetry dataset). To do that it requires:

  1. a bathymetry dataset, the name of which is hard-coded to bathy_meter.nc

  2. a namelist file, the name of which is hard-coded to namelist, and an example of which is contained in the NEMO_Preparation/4_weights_ATMOS/ directory

  3. one or more atmospheric forcing dataset file(s), the name of which is defined in the namelist

The output of get_weight_nemo is a weights file, the name of which is hard-coded to met_gem_weight.nc.

We’ll run get_weight_nemo in a clone of the grid, so start by symlinking the sample namelist file to there as namelist:

$ cd MEOPAR/grid/
$ ln -s namelist.get_weight_nemo.gem2.5-ops namelist

Symlink the bathymetry dataset as bathy_meter.nc:

$ ln -s bathymetry_201702.nc bathy_meter.nc

The only values that get_weight_nemo actually uses from the atmospheric forcing dataset file is the grid point locations, but the namelist file is more complicated. We can reduce the complexity by using a single atmospheric forcing dataset file as a climatology, so we symlink one as atmos.nc:

$ ln -s /results/forcing/atmospheric/GEM2.5/operational/ops_y2015m01d01.nc atmos.nc

The namelist file looks like:

!-----------------------------------------------------------------------
&namsbc_core !   namsbc_core  CORE bulk formulea
!-----------------------------------------------------------------------
!            ! file name ! variable   ! clim  ! 'yearly'/
!            !           !  name      ! (T/F) ! 'monthly'
   sn_wndi   = 'atmos',   'u_wind'   , .true., 'yearly'
   sn_wndj   = 'atmos',   'v_wind'   , .true., 'yearly'
   sn_qsr    = 'atmos',   'solar'    , .true., 'yearly'
   sn_qlw    = 'atmos',   'therm_rad', .true., 'yearly'
   sn_tair   = 'atmos',   'tair'     , .true., 'yearly'
   sn_humi   = 'atmos',   'qair'     , .true., 'yearly'
   sn_prec   = 'atmos',   'precip'   , .true., 'yearly'
   sn_snow   = 'atmos',   'snow'     , .true., 'yearly'
   cn_dir    = './'      !  root directory for the location of the bulk files
/

The important things here are:

  • The file name must match the name of the atmospheric forcing dataset file symlink, without the .nc extension.

  • The climatology field (clim (T/F)) must be set to .true. for all variables.

  • The value of cn_dir must be './'.

Finally, run get_weight_nemo:

MEOPAR/NEMO-EastCoast/NEMO_Preparation/4_weights_ATMOS/get_weight_nemo

The output should be something like:

 sbc_blk_core : flux formulation for ocean surface boundary condition
 ~~~~~~~~~~~~
           namsbc_core Namelist
           list of files
                root filename: ./atmos variable name: u_wind climatology:  T  data type: yearly
                root filename: ./atmos variable name: v_wind climatology:  T  data type: yearly
                root filename: ./atmos variable name: qair climatology:  T  data type: yearly
                root filename: ./atmos variable name: solar climatology:  T  data type: yearly
                root filename: ./atmos variable name: therm_rad climatology:  T  data type: yearly
                root filename: ./atmos variable name: tair climatology:  T  data type: yearly
                root filename: ./atmos variable name: precip climatology:  T  data type: yearly
                root filename: ./atmos variable name: snow climatology:  T  data type: yearly
 reading : ./atmos.nc
 atmospheric forcing netcdf grid dimensions: nx=         256 , ny=         266
           get_atmo_grid ~~~ found X axis varid:           3
           get_atmo_grid ~~~ found Y axis varid:           2
 grid_type           2
xmin/xmax/origin  0.230833E+03  0.240530E+03  0.230833E+03
 writing variable : src01
        8065        8065        8321        8321
 status put           0
 writing variable : wgt01
 writing variable : src02
        8321        8321        8065        8065
 status put           0
 writing variable : wgt02
 writing variable : src03
        8064        8064        8320        8320
 status put           0
 writing variable : wgt03
 writing variable : src04
        8320        8320        8064        8064
 status put           0
 writing variable : wgt04

and a met_gem_weight.nc file should be created.

Use the I_ForcingFiles/Atmos/ImproveWeightsFile.ipynb notebook to transform met_gem_weight into a netCDF4 file called weights-gem2.5-ops_201702.nc with well-structured metadata (see netCDF4 Files Creation and Conventions).

CGRF Dataset

The Canadian Meteorological Centre’s (CMC) Global Deterministic Prediction System (GDPS) Reforecasts (CGRF) dataset is a relatively high-resolution forcing dataset for ocean models [Smith_etal2013]. The dataset is hosted on an rsync server at goapp.ocean.dal.ca. User id and password credentials are required to access it.

At the command line you can explore the dataset with commands like:

rsync <userid>@goapp.ocean.dal.ca::canadian_GDPS_reforecasts_v1/2002/2002091500
Password:
dr-xr-xr-x        4096 2012/06/14 06:59:22 2002091500

and

rsync <userid>@goapp.ocean.dal.ca::canadian_GDPS_reforecasts_v1/2002/2002091500/
Password:
dr-xr-xr-x        4096 2012/06/14 06:59:22 .
-r-xr-xr-x     8844469 2011/06/06 07:46:01 2002091500_precip.nc.gz
-r-xr-xr-x    27045976 2011/01/14 21:37:09 2002091500_q2.nc.gz
-r-xr-xr-x    20960161 2011/01/14 21:37:26 2002091500_qlw.nc.gz
-r-xr-xr-x    10451631 2011/01/14 21:37:34 2002091500_qsw.nc.gz
-r-xr-xr-x    11655341 2011/01/14 21:37:37 2002091500_slp.nc.gz
-r-xr-xr-x    27080056 2011/01/14 21:37:15 2002091500_t2.nc.gz
-r-xr-xr-x    37703920 2011/01/14 21:37:04 2002091500_u10.nc.gz
-r-xr-xr-x    37641390 2011/01/14 21:37:05 2002091500_v10.nc.gz

Note that the trailing slash causes the contents of a directory to be accessed while its absence refers to the directory itself.

To make a local copy of files use the -rltv options and provide a destination directory (which will be created if it doesn’t already exist):

rsync -rltv <userid>@goapp.ocean.dal.ca::canadian_GDPS_reforecasts_v1/2002/2002091500/ 2002-09-15/
Password:
receiving incremental file list
./
2002091500_precip.nc.gz
2002091500_q2.nc.gz
2002091500_qlw.nc.gz
2002091500_qsw.nc.gz
2002091500_slp.nc.gz
2002091500_t2.nc.gz
2002091500_u10.nc.gz
2002091500_v10.nc.gz

sent 234 bytes  received 181405678 bytes  6596578.62 bytes/sec
total size is 181382944  speedup is 1.00

The local files are created with 555 permissions. Make them user and group writable so that they can be decompressed, and non-executable with:

chmod 664 2002-09-15/*

The salishsea get_cgrf tool automates this process.

Pressure Correction

The CGRF atmospheric model uses a terrain following vertical coordinate system which means that the lowest grid cells are not at sea level in mountainous regions such as those surrounding the Salish Sea. As such, we have developed an algorithm to adjust CGRF pressure files to sea level. First, the altitude of each grid cell is computed since this is not given in the CGRF output. Given the of an air parcel, we can approximate its height \(z_1\) above sea level using the following formula [Holton1992]:

\[p_s = p_1\left(\gamma\frac{z_1}{T_1} +1 \right)^\frac{g}{\gamma R}\]

where \(g\) is the acceleration due to gravity, \(R\) is the ideal gas constant, and \(\gamma\) is the temperature lapse rate of the atmosphere (0.0098 degrees/m).

To arrive at this formula we have made a few assumptions:

  1. The atmosphere is in hydrostatic equilibrium: \(\frac{d p}{d z} = -\rho g\)

  2. The atmosphere is an ideal gas: \(p = \rho R T\)

  3. The temperature of the atmosphere decreases with height at a constant rate: \(\frac{dT}{dz} = -\gamma\)

The altitude of each grid cell is stored in a file altitude_CGRF.nc in the tools/I_ForcingFiles/Atmos repository.

Ths sea level pressure calculation is performed in nc_tools.generate_pressure_file, which is used in salishsea get_cgrf to correct pressure files on download. Corrected pressure files are named slp_corr_y0000m00d00.nc. See the tools docs for details on nc_tools.generate_pressure_file method.

Note

salishsea get_cgrf requires a link to altitude_CGRF.nc in /NEMO-atmos/.

[Smith_etal2013]

Smith, G. C., Roy, F., Mann, P., Dupont, F., Brasnett, B., Lemieux, J.-F., Laroche, S. and Bélair, S. (2013), A new atmospheric dataset for forcing ice–ocean models: Evaluation of reforecasts using the Canadian global deterministic prediction system. Q.J.R. Meteorol. Soc. https://dx.doi.org/10.1002/qj.2194

[Holton1992]

Holton, J., An introduction to dynamic meteorology 3rd edition (Acadmeic Press: 1992)