Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions docs/grid.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,18 @@ Calculate the missing horizontal grid variables and add them to grid.
@author Ryan Patmore
@author Anthony Wise

## *class* grid.zgr.Z_Grid(zgr_file, name_map_file, hgr_type, e_dict, logger, dst=1)
## *class* grid.zgr.Z_Grid(zgr_file, zgr_type, name_map_file, hgr_type, e_dict, logger, dst=1)

> Bases: `object`<br>

### *method* \_\_init\_\_(zgr_file, name_map_file, hgr_type, e_dict, logger, dst=1)
### *method* \_\_init\_\_(zgr_file, zgr_type, name_map_file, hgr_type, e_dict, logger, dst=1)

Master depth class.

> ### Parameters<br>

> zgr_file (str) : string of file for loading zgr data<br>
> zgr_type (str) : zgr type from namelist zco, zps or sco<br>
> name_map_file (str) : string of file for mapping variable names<br>
> hgr_type (str) : horizontal grid type<br>
> e_dict (dict) : dictionary of e1 and e2 scale factors<br>
Expand All @@ -116,7 +117,7 @@ Master depth class.

> Depth (object) : Depth object<br>

### *method* find_zgrid_type()
### *method* find_zgrid_type(zgr_type)

Find out what type of vertical grid is provided zco, zps or sigma levels (sco).

Expand Down
35 changes: 33 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ The changes relative to the previous version (0.3.0) are:
- Bug fix for 90 boundaries that meet diagonally to produce a 90 degree corner.
- Some unit tests have been added and full integration tests.
- Documentation has been updated and restructured.
- sn_src_zgr_type and sn_dst_zgr_type are defined in the namelist.bdy

**There is a new library for generating NEMO initial conditions called pyIC.**
pyIC can be found at: [https://github.com/NOC-MSM/pyIC](https://github.com/NOC-MSM/pyIC)
Expand Down Expand Up @@ -198,6 +199,8 @@ Here we will summarise the main variables that will need changing to get started

#### Key Namelist Parameters

- `sn_src_zgr_type`
- `sn_dst_zgr_type`
- `sn_src_hgr`
- `sn_src_zgr`
- `sn_dst_hgr`
Expand All @@ -211,6 +214,11 @@ Here we will summarise the main variables that will need changing to get started
- `ln_zinterp`
- `nn_rimwidth`

##### Vertical grid type

- **`sn_src_zgr_type`**: The source vertical coordinate type. This can be 'zco', 'zps' or 'sco'. 'zco' for the z-coordinate full step which are not spatially verying, 'zps' for z-coordinate - partial steps which have some adjustment in height near the seabed and 'sco' for sigma or hybrid z-sigma-coordinates which get thicker or thinner depending on the bathymetry.
- **`sn_dst_zgr_type`**: Same as `sn_src_zgr_type` but for destination vertical coordinate type.

##### File Paths

Directory paths in bdy file can be relative or absolute.
Expand Down Expand Up @@ -448,6 +456,10 @@ Summary of minimum requirements:
"e3uw" = * vertical scale factor distance between w-levels on u-grid (dims [t, z, y, x])
"e3vw" = * vertical scale factor distance between w-levels on v-grid (dims [t, z, y, x])
"e3fw" = * vertical scale factor distance between w-levels on f-grid (dims [t, z, y, x])

"ln_zco" = * flag for zco vertical coordinates 1 for true, 0 for false often provided in domain_cfg.nc
"ln_zps" = * flag for zps vertical coordinates 1 for true, 0 for false often provided in domain_cfg.nc
"ln_sco" = * flag for sco vertical coordinates 1 for true, 0 for false often provided in domain_cfg.nc
```

### Step 5: Running pyBDY
Expand All @@ -473,6 +485,19 @@ The example child (destination) here is a regional NEMO model that covers the In

Below is excerpts from an example *namelist.bdy*.

This sections tells pybdy the vertical coordinate type of the parent (src) and child (dst). In this case the the parent is on constant z-levels and the child is on spatially varying sigma-levels.

```
!------------------------------------------------------------------------------
! vertical coordinate
!------------------------------------------------------------------------------
sn_src_zgr_type = 'zco' ! vertical coordinate type: 'zco', 'zps' or 'sco'
sn_dst_zgr_type = 'sco' ! vertical coordinate type: 'zco', 'zps' or 'sco'
! 'zco' is z-coordinate - full steps
! 'zps' is z-coordinate - partial steps
! 'sco' is s- or hybrid z-s-coordinate
```

Here the file paths are set. These can be absolute (i.e. starting with "/") or relative (i.e. starting with "./"). For help with what variables are needed in these files see [How to use pyBDY :student:](#how-to-use-pybdy-student). In the example case, the bathmetry file needed to be calculated before running pybdy. It may also be the case that you need to calculate variables like gdept for the sn_src_zgr file fore running pybdy. For setting up the grid_name_map.json see the JSON file example section below.

```
Expand Down Expand Up @@ -637,7 +662,10 @@ This is an example .json file: *grid_name_map.json*. It specifise the names of v
"e3f": "e3f",
"e3uw": "e3uw",
"e3vw": "e3vw",
"e3fw": "e3fw"
"e3fw": "e3fw",
"ln_zco": "ln_zco",
"ln_zps": "ln_zps",
"ln_sco": "ln_sco"
},
"dst_variable_map": {
"nav_lon": "nav_lon",
Expand Down Expand Up @@ -674,7 +702,10 @@ This is an example .json file: *grid_name_map.json*. It specifise the names of v
"e3f": "e3f_0",
"e3uw": "e3uw_0",
"e3vw": "e3vw_0",
"e3fw": "e3fw"
"e3fw": "e3fw",
"ln_zco": "ln_zco",
"ln_zps": "ln_zps",
"ln_sco": "ln_sco"
}
}
```
Expand Down
22 changes: 11 additions & 11 deletions docs/pybdy.gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ Initialise an APLpyNormalize instance.
> Optional Keyword Parametersument<br>

> *vmin*: [ None | float ]<br>
> : Minimum pixel value to use for the scaling.<br>
> : Minimum pixel value to use for the scaling.<br>

> *vmax*: [ None | float ]<br>
> : Maximum pixel value to use for the scaling.<br>
> : Maximum pixel value to use for the scaling.<br>

> *stretch*: [ ‘linear’ | ‘log’ | ‘sqrt’ | ‘arcsinh’ | ‘power’ ]<br>
> : The stretch function to use (default is ‘linear’).<br>
> : The stretch function to use (default is ‘linear’).<br>

> *vmid*: [ None | float ]<br>
> : Mid-pixel value used for the log and arcsinh stretches. If<br>
> set to None, a default value is picked.<br>
> : Mid-pixel value used for the log and arcsinh stretches. If<br>
> set to None, a default value is picked.<br>

> *exponent*: [ float ]<br>
> : if self.stretch is set to ‘power’, this is the exponent to use.<br>
> : if self.stretch is set to ‘power’, this is the exponent to use.<br>

> *clip*: [ True | False ]<br>
> : If clip is True and the given value falls outside the range,<br>
> the returned value will be 0 or 1, whichever is closer.<br>
> : If clip is True and the given value falls outside the range,<br>
> the returned value will be 0 or 1, whichever is closer.<br>

### *method* inverse(value)

Expand All @@ -45,7 +45,7 @@ data value.

value

> : Normalized value.<br>
> \: Normalized value.<br>

# pybdy.gui.nemo_bdy_input_window module

Expand Down Expand Up @@ -286,7 +286,7 @@ Run callback for the dropdown in the settings.

Run callback when the True/False dropdown for the settings,

> : which has a boolean value, is changed.<br>
> \: which has a boolean value, is changed.<br>

### *method* init_ui()

Expand Down Expand Up @@ -494,7 +494,7 @@ Refresh the canvas.

This method looks at the list of points available and depending on the number of points

> : in the list creates a point or line or a polygon and draws them.<br>
> \: in the list creates a point or line or a polygon and draws them.<br>

### *method* reset()

Expand Down
6 changes: 3 additions & 3 deletions docs/pybdy.md
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ Interpolate source data onto destination vertical levels.
> sc_bdy (np.array) : souce data [nz_sc, nbdy, 9]<br>
> dst_dep (np.array) : the depth of the destination grid chunk [nz, nbdy]<br>
> bdy_bathy (np.array): the destination grid bdy points bathymetry<br>
> z_ind (np.array) : the indices of the sc depth above and below bdy<br>
> z_ind (np.array) : the indices of the sc depth above and below bdy point<br>
> z_dist (np.array) : the distance weights of the selected points<br>
> num_bdy (int) : number of boundary points in chunk<br>
> zinterp (bool) : vertical interpolation flag<br>
Expand Down Expand Up @@ -498,8 +498,8 @@ weightings for vector quantities.
> DstCoord (obj) : destination grid information<br>
> Grid (dict) : containing grid type ‘t’, ‘u’, ‘v’ and source time<br>
> var_name (list) : netcdf file variable names (str)<br>
> years (list) : years to extract (default [1979])<br>
> months (list) : months to extract (default [11])<br>
> grd (str) : grid to process ‘t’, ‘u’, ‘v’<br>
> pair (str) : None or ‘uv’<br>

> ### Returns<br>

Expand Down
8 changes: 4 additions & 4 deletions docs/pybdy.tide.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ Convert the input contituents to index in the tidal constituents.
> ### Parameters<br>

> constituents: The list of constituents available from the source data<br>
> : e.g. TPXO: [‘m2’, ‘s2’, ‘n2’, ‘k2’, ‘k1’, ‘o1’, ‘p1’, ‘q1’, ‘mf’, ‘mm’, ‘m4’, ‘ms4’, ‘mn4’]<br>
> : e.g. TPXO: [‘m2’, ‘s2’, ‘n2’, ‘k2’, ‘k1’, ‘o1’, ‘p1’, ‘q1’, ‘mf’, ‘mm’, ‘m4’, ‘ms4’, ‘mn4’]<br>

> inputcons: The dictionary of constituents from the namelist with their numbers<br>
> : e.g. {‘1’: “‘M2’”, ‘3’: “‘K2’”, ‘2’: “‘S2’”, ‘4’: “‘M4’”}<br>
> : e.g. {‘1’: “‘M2’”, ‘3’: “‘K2’”, ‘2’: “‘S2’”, ‘4’: “‘M4’”}<br>

> ### Returns<br>

> retindx: The indices (relative to the source data list) of the dictionary items from the namelist<br>
> : e.g. [ 0. 3. 1. 10.]<br>
> : e.g. [ 0. 3. 1. 10.]<br>

## pybdy.tide.nemo_bdy_tide3.nemo_bdy_tide_rot(setup, DstCoord, Grid_T, Grid_U, Grid_V, comp)

Expand Down Expand Up @@ -140,7 +140,7 @@ TPXO9v5 only carries the bathymetry variable
> return: mask dataarray.<br>

> Useage:<br>
> : self.grid[mask_name] = generate_landmask(bathy_name)<br>
> : self.grid[mask_name] = generate_landmask(bathy_name)<br>

### *method* interpolate_constituents(nc_dataset, real_var_name, img_var_name, lon_var_name, lat_var_name, lon, lat, height_data=None, maskname=None)

Expand Down
10 changes: 8 additions & 2 deletions inputs/grid_name_map.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
"e3f": "e3f",
"e3uw": "e3uw",
"e3vw": "e3vw",
"e3fw": "e3fw"
"e3fw": "e3fw",
"ln_zco": "ln_zco",
"ln_zps": "ln_zps",
"ln_sco": "ln_sco"
},
"dst_variable_map": {
"nav_lon": "nav_lon",
Expand Down Expand Up @@ -77,6 +80,9 @@
"e3f": "e3f",
"e3uw": "e3uw",
"e3vw": "e3vw",
"e3fw": "e3fw"
"e3fw": "e3fw",
"ln_zco": "ln_zco",
"ln_zps": "ln_zps",
"ln_sco": "ln_sco"
}
}
4 changes: 4 additions & 0 deletions inputs/grid_name_map_readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,7 @@ In all cases "t" should be size 1. Pybdy does not deal with time varying grids.
"e3uw" = * vertical scale factor distance between w-levels on u-grid (dims [t, z, y, x])
"e3vw" = * vertical scale factor distance between w-levels on v-grid (dims [t, z, y, x])
"e3fw" = * vertical scale factor distance between w-levels on f-grid (dims [t, z, y, x])

"ln_zco" = * flag for zco vertical coordinates 1 for true, 0 for false often provided in domain_cfg.nc
"ln_zps" = * flag for zps vertical coordinates 1 for true, 0 for false often provided in domain_cfg.nc
"ln_sco" = * flag for sco vertical coordinates 1 for true, 0 for false often provided in domain_cfg.nc
9 changes: 9 additions & 0 deletions inputs/namelist_local.bdy
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
!!
!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

!------------------------------------------------------------------------------
! vertical coordinate
!------------------------------------------------------------------------------
sn_src_zgr_type = 'zps' ! vertical coordinate type: 'zco', 'zps' or 'sco'
sn_dst_zgr_type = 'zps' ! vertical coordinate type: 'zco', 'zps' or 'sco'
! 'zco' is z-coordinate - full steps
! 'zps' is z-coordinate - partial steps
! 'sco' is s- or hybrid z-s-coordinate

!------------------------------------------------------------------------------
! grid information
!------------------------------------------------------------------------------
Expand Down
9 changes: 9 additions & 0 deletions inputs/namelist_remote.bdy
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
!!
!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

!------------------------------------------------------------------------------
! vertical coordinate
!------------------------------------------------------------------------------
sn_src_zgr_type = 'sco' ! vertical coordinate type: 'zco', 'zps' or 'sco'
sn_dst_zgr_type = 'sco' ! vertical coordinate type: 'zco', 'zps' or 'sco'
! 'zco' is z-coordinate - full steps
! 'zps' is z-coordinate - partial steps
! 'sco' is s- or hybrid z-s-coordinate

!------------------------------------------------------------------------------
! grid information
!------------------------------------------------------------------------------
Expand Down
Loading
Loading