When the model section gridfile has been generated (and eventually the model domain file), the user can now load the model outputs.

Loading data on sections is achieved by using the pypago.data.loaddata_sec_T() and pypago.data.loaddata_sec_UV() functions, depending of the grid (T, U or V) in which the variable is stored.

Loading sections from T points is achieved by using the pypago.data.loaddata_sec_T() function.

Its arguments are i) the list of pypago.sections.GridSection objects ii) the NetCDF filename containing the variables to process iii) a dictionnary containing the variables to process (dictionnary values) and the name in which they will appear in the output object (dictionary keys). In the example below, the votemper and the vosaline variables are read from the input file and are stored as temp and sal attributes, respectively.

Loading sections from U/V points is achieved by using the pypago.data.loaddata_sec_UV()

Its arguments are i) the list of pypago.sections.GridSection objects ii) the names of the NetCDF files containing the variables on the U and V points iii) a dictionnary containing the two names of the variables to process (dictionnary values, which is a list since the variable may have two different names depending of the file) and the name in which the variable will appear in the output object (dictionary keys). In the example below, we process the velocity field, whose name is uo in the grid U file and vo in the grid V file. This velocity field will be stored as the vel attribute.

Note

If in your model run, tracer transports (for instance heat transport) have been stored on U/V points, you may use this function to extract them. It gives better precision when computing heat budgets within closed domains.

Loading the NetCDF time is achieved by using the pypago.data.loadtime() function (which uses the pypago.pyio.read_time() function) as follows:

The time is added as a time attribute.

Note

The name of the time variable is specified in the param.py file

### 2.5.1.4. Example¶

import pypago.pyio
import pypago.data

filenameT = 'data/dyna_grid_T.nc'
filenameU = 'data/dyna_grid_U.nc'
filenameV = 'data/dyna_grid_V.nc'

dirvarT = {'temp':'votemper', 'salt': 'vosaline'}

dirvarUV = {'vel':['vozocrtx', 'vomecrty']}
modelsec = pypago.data.loaddata_sec_UV(modelsec, filenameU, filenameV, dirvarUV)

pypago.pyio.save(modelsec, 'data/indian_datasec.pygo')

In [1]: import pypago.pyio

In [3]: print(data[0])
Gridded section, NEMO model:
-areavect: (31, 70)
-depthvect: (31, 70)
-dire: (1,)
-faces: (70,)
-i: (2,)
-imax: 40
-imin: 140
-j: (2,)
-jmax: 100
-jmin: 10
-lengthvect: (70,)
-lvect: (70,)
-modelname: NEMO
-name: section4
-nlon: 182
-orient: (70,)
-salt: (73, 31, 70)
-temp: (73, 31, 70)
-time: (73,)
-veci: (70,)
-vecj: (70,)
-vel: (73, 31, 70)


Loading data on domain areas is achieved by using the pypago.data.loaddata_area_T() function. The philosophy is the same as when loading section data from T points. However, a major difference is that here, 2D variables (for instance, surface heat fluxes) can be loaded. In the above example, the 3D (time, latitude, longitude) votemper and vosaline variables are loaded as temp and salt, respectively, while the 2D variable sohefldo is loaded as hf.

Time is loaded as for sections, i.e. by using the pypago.data.loadtime() function.

### 2.5.2.3. Example¶

import pypago.pyio
import pypago.data

filenameT = 'data/dyna_grid_T.nc'

dirvarT = {'temp':'votemper', 'salt': 'vosaline',
'hf':'sohefldo', 'ssh':'sossheig'}


In [4]: import pypago.pyio

In [6]: print(data[0])
Domain area, NEMO model:
-hf: (73, 461)
-i: (461,)
-imax: 160
-imin: 90
-j: (461,)
-jmax: 147
-jmin: 80