Create gridded sections ########################## Once the section longitude and latitude endpoints have been defined, and the :samp:`param.py` file has been properly set, the next step is to process the model grid. This is achieved in three steps: #. Coordinates and scale factors are extracted over the entire domain and stored into a :py:class:`pypago.coords.Coords` object. #. Coordinates and scale factors are extracted over the region of interest, and the variables are eventually zonally flipped. The subdomain variables are stored in a :py:class:`pypago.grid.Grid` object. #. Finally, the section endpoints are converted into the :py:class:`pypago.grid.Grid` object, and sections out of the domain are discarded. These steps can be performed either by using Python scripts or by using the :py:mod:`pypago.guis.gui_grid_model` Python program. .. warning:: These steps require a NetCDF file containing the variables defined in the :samp:`dictvname` variable (either default values or values defined in the :samp:`param.py` file). Both methods are described bellow. Using Python scripts ******************** Extracting coord objects ======================== Extraction of coord objects is achieved by using the :py:func:`pypago.coords.create_coord` function as follows: .. literalinclude:: ../examples/define_coords.py .. ipython:: python import os cwd = os.getcwd() print(cwd) fpath = "examples/define_coords.py" with open(fpath) as f: code = compile(f.read(), fpath, 'exec') exec(code) .. ipython:: python print(coord) Note that the user may also use the executable program :py:mod:`pypago.bin.make_coords` as follows: .. literalinclude:: ../examples/script_coords.sh The arguments are the model name, the path of the meshfile and the path of the output file. .. note:: The :samp:`param.py` file still needs to be in the working directory Extracting grid objects ======================= The grid objects are obtained by using the :py:func:`pypago.grid.create_grid` function. Its arguments are the i (:samp:`imax` and :samp:`imin`) and j (:samp:`jmin` and :samp:`jmax`) indexes of the subdomain to extract. When one argument is :samp:`None`, then the higher (or lower) possible index is taken. Note that if :samp:`imax