# 3.3. Setting up the grid¶

Once the LTL forcing file has been set-up, it can be used to create the parameters that will be used to generate the Osmose grid.

Recovering the grid parameters is done by using the extract_grid_param function:

rm(list=ls())

library("osmose")
setwd("/home/nbarrier/Modeles/osmose/git-applis/doc_user/newconf/_static")

ltl_file = system.file(package="osmose", "extdata", "gog_v4",
"corr_eco3m_gog44_conversion_factor.nc")

# extract the grid parameters
gridpar = extract_grid_param(ltl_file, lonname="longitude",
latname="latitude", csv="grid_param.csv")
gridpar

Longitude and Latitudes are 1D.
They are be converted into 2D arrays.
value
grid.java.classname fr.ird.osmose.grid.OriginalGrid
grid.nlon                                        40
grid.nlat                                        26
grid.lowright.lat                  33.2827208709717
grid.lowright.lon                  13.2567700606126
grid.upleft.lat                    34.9970680999756
grid.upleft.lon                    9.92158611004169


In this example, the parameters are written in the grid_param.csv, which is readable by Osmose.

The LTL forcing file can also be used to generate CSV file containing the land-sea mask of the Osmose domain. This is done by using the extract_grid_mask function.

# extract the grid mask file

# revert data for the plot

Fig. 3.1 Land-sea mask generated by the extract_grid_mask function.