Service module for support of SMC regridding and interpolation. More...
Functions/Subroutines | |
| subroutine | smc_interp () |
| Generate SMC interpolation/output information. More... | |
| subroutine | w3s2xy_smcrg (S, XY) |
| Regrid SMC data onto a regular grid. More... | |
| subroutine | w3s2xy_smcrg_dir (S, XY) |
| Regrid directional SMC data onto a regular grid. More... | |
| subroutine | mapsta_smc () |
| Calculates a new MAPSTA using SMC grid cell averaging. More... | |
| subroutine | read_smcint () |
| Read interpolation information from smcint.ww3. More... | |
| subroutine | calc_interp () |
| Calculates weights for SMC to arbitrary grid intepolation. More... | |
| subroutine | w3s2xy_smcnn (S, XY, DIRN) |
| Fill regular grid using nearest SMC point data. More... | |
| subroutine | w3s2xy_smcnn_int (S, XY, DIRN) |
| Nearest neighbour interpolation. More... | |
| subroutine | w3s2xy_smc (S, XY, DIR) |
| Entry point for SMC version of W3S2XY. More... | |
Variables | |
| double precision | sxo |
| Output grid longitude origin. More... | |
| double precision | syo |
| Output grid latitude origin. More... | |
| double precision | exo |
| Output grid final longitude. More... | |
| double precision | eyo |
| Output grid final latitude. More... | |
| double precision | dxo |
| Output grid cell longitude size. More... | |
| double precision | dyo |
| Output grid cell latitude size. More... | |
| integer | nxo |
| Output grid number of longitude cells. More... | |
| integer | nyo |
| Output grid number of latitude cells. More... | |
| integer | smcotype |
| Type of SMC output: 1=seapoint grid of SMC cells; 2=regridding to regular grid; 3=interpolation to arbtrary grid; 4=nearest neighbour interpolation to arbitrary grid. More... | |
| integer | celfac |
| Output grid cell scaling factor; should be an integer power of 2. More... | |
| integer, dimension(:), allocatable | xidx |
| X-indices of SMC cells in regular grid. More... | |
| integer, dimension(:), allocatable | yidx |
| Y-Indices of SMC cells in regular grid. More... | |
| integer, dimension(:), allocatable | xspan |
| Number of longitude cells SMC cell spans. More... | |
| integer, dimension(:), allocatable | yspan |
| Number of longitude cells SMC cell spans. More... | |
| real, dimension(:), allocatable | wts |
| Regridding weights. More... | |
| real, dimension(:,:), allocatable | cov |
| Wet fraction (coverage) of cell. More... | |
| integer, dimension(:,:), allocatable | mapsmc |
| Regridded MAPSTA. More... | |
| logical, dimension(:), allocatable | smcmask |
| Mask for type 1 output (flat array) More... | |
| integer, dimension(:), allocatable | smcidx |
| Indices of SMC cells within output grid domain. More... | |
| integer, dimension(:), allocatable | smccx |
| SMC grid definition. More... | |
| integer, dimension(:), allocatable | smccy |
| Latitude cell size factors. More... | |
| real | dlat |
| Base longitude cell size. More... | |
| real | dlon |
| Base latitude cell size. More... | |
| integer | cfac |
| SMC scaling factor (number of levels) More... | |
| real | noval |
| Fill value for seapoints with no value. More... | |
| integer, dimension(:,:), allocatable | nnidx |
| Nearest neighbour SMC point to regular grid. More... | |
| real, dimension(:,:), allocatable | xdist |
| Lng. More... | |
| real, dimension(:,:), allocatable | ydist |
| Lat. More... | |
| integer | ndsmc |
| ww3_smcint file unit number More... | |
| integer | smcnout |
| Number of SMC output cells. More... | |
| integer | nsmc |
| Number of SMC cells used in regridding. More... | |
Service module for support of SMC regridding and interpolation.
For SMC grids, four types of output are possible:
* The ww3_smcint program is experimental and not yet included in the official WW3 distribution; it is currently part of the UK Met Office's suite of internal tools.
| Date | Ver | Comments |
|---|---|---|
| 18-Jan-2016 | 4.18 | Initial version |
| 28-Sep-2016 | 4.18 | Bug fix EXO/EYO calcs for whole domain output |
| 05-Oct-2016 | 4.18 | Bug fix regular grid indicies for type 2 output |
| 29-Sep-2017 | 4.18 | Revise calculation of indicies to ensure selected cells fall inside user selected areas. |
| 18-Apr-2018 | 4.18 | Added Type 3 and 4 SMC output |
| 20-Jun-2018 | 4.18 | Directional fields output as nautical convention (deg) |
| 27-Jun-2018 | 6.05 | Ported to V6 |
| 06-Jan-2021 | 7.12 | Use ARCTC option for SMC grid. |
| 20-Jul-2021 | 7.12 | Fix bug where edge cells in design grid may not be matched due where SMC cell > base grid size. |
| 21-Jul-2021 | 7.12 | Elevated some grid variables to DOUBLE PRECISION, fixed EXO/EYO bug |
| subroutine w3smcomd::calc_interp |
Calculates weights for SMC to arbitrary grid intepolation.
Calculates the interpolation indices and weights for regridding an SMC grid to an arbitrary regular grid. Calculated index is that of the SMC cell that contains output cell centre. Weights are the distance in metres between the output and SMC cell centres.
A future version may allow for output grids to be on a rotated pole.
Definition at line 623 of file w3smcomd.F90.
References w3gdatmd::clats, constants::dera, dlat, dlon, dxo, dyo, nnidx, w3gdatmd::polat, w3gdatmd::polon, constants::radius, sxo, syo, w3servmd::w3lltoeq(), xdist, and ydist.
| subroutine w3smcomd::mapsta_smc |
Calculates a new MAPSTA using SMC grid cell averaging.
Definition at line 519 of file w3smcomd.F90.
References cov, w3gdatmd::mapsf, mapsmc, w3gdatmd::mapsta, w3gdatmd::nsea, nxo, nyo, wts, xidx, xspan, yidx, and yspan.
| subroutine w3smcomd::read_smcint |
Read interpolation information from smcint.ww3.
Reads the interpolation indices and distance weights from the smcint.ww3 file generated by ww3_smcint program.
Definition at line 580 of file w3smcomd.F90.
References dxo, dyo, w3servmd::extcde(), file(), constants::file_endian, ndsmc, nnidx, nxo, nyo, sxo, syo, xdist, and ydist.
| subroutine w3smcomd::smc_interp |
Generate SMC interpolation/output information.
This subroutine generates index or mask values for extraction of SMC data to either a flat grid or regular lat/lon grid, depending on the type of SMC output grid selected:
Type 1: Generates a mask for extracting only points from the user requested region.
Type 2: Calculate interpolation indices and weights for regridding the irregular SMC grid onto a regular, uniformly spaced lat/lon grid.
Definition at line 143 of file w3smcomd.F90.
References w3gdatmd::arctc, celfac, cfac, dlat, dlon, dxo, dyo, exo, eyo, w3gdatmd::ijkcel, w3gdatmd::narc, w3gdatmd::nbac, w3gdatmd::nglo, w3gdatmd::nrlv, w3gdatmd::nsea, nsmc, w3gdatmd::nx, nxo, w3gdatmd::ny, nyo, smcidx, smcmask, smcotype, w3gdatmd::sx, sxo, w3gdatmd::sy, syo, wts, w3gdatmd::x0, xidx, xspan, w3gdatmd::y0, yidx, and yspan.
| subroutine w3smcomd::w3s2xy_smc | ( | real, dimension(:), intent(in) | S, |
| real, dimension(nxo,nyo), intent(out) | XY, | ||
| logical, optional | DIR | ||
| ) |
Entry point for SMC version of W3S2XY.
Dispatches to regridding subroutine based on SMCOTYPE. Optional DIR logical specifies whether field is a directional value; in which case it will be decomposed into u/v components prior to any interpolation.
| [in] | S | Input array on SMC grid |
| [out] | XY | Output array to store interpolated 2D field |
| [in] | DIR | (Optional) Set to .TRUE. if S is a directional field |
Definition at line 817 of file w3smcomd.F90.
References constants::rade, smcmask, smcotype, constants::undef, w3s2xy_smcnn(), w3s2xy_smcnn_int(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().
| subroutine w3smcomd::w3s2xy_smcnn | ( | real, dimension(:), intent(in) | S, |
| real, dimension(nxo,nyo), intent(out) | XY, | ||
| logical, intent(in) | DIRN | ||
| ) |
Fill regular grid using nearest SMC point data.
Directional fields (DIRN=True) will be assumed to be in radians and will be converted to degrees in nautical convention.
| [in] | S | Input array on SMC grid |
| [out] | XY | Output array to store interpolated 2D field |
| [in] | DIRN | Set to .TRUE. if S is a directional field |
Definition at line 712 of file w3smcomd.F90.
References nnidx, noval, constants::rade, and constants::undef.
Referenced by w3s2xy_smc().
| subroutine w3smcomd::w3s2xy_smcnn_int | ( | real, dimension(:), intent(in) | S, |
| real, dimension(nxo,nyo), intent(out) | XY, | ||
| logical, intent(in) | DIRN | ||
| ) |
Nearest neighbour interpolation.
Fill regular grid using nearest SMC point data and interpolate output value based on local gradient and distance between grid cell centres.
Directional fields (DIRN=True) will be assumed to be in radians and will be converted to degrees in nautical convention.
| [in] | S | Input array on SMC grid |
| [out] | XY | Output array to store interpolated 2D field |
| [in] | DIRN | Set to .TRUE. if S is a directional field |
Definition at line 763 of file w3smcomd.F90.
References nnidx, constants::rade, w3psmcmd::smcgradn(), constants::undef, xdist, and ydist.
Referenced by w3s2xy_smc().
| subroutine w3smcomd::w3s2xy_smcrg | ( | real, dimension(:), intent(in) | S, |
| real, dimension(nxo,nyo), intent(out) | XY | ||
| ) |
Regrid SMC data onto a regular grid.
Regrids scalar data from the SMC grid onto a regular grid. Uses pre-calculated grid indices and weights generated from the smc_interp() subroutine.
| [in] | S | Source field, on SMC grid. |
| [out] | XY | Storage for regridded field; must be 2D array with dimensions of (NXO,NYO). |
Definition at line 360 of file w3smcomd.F90.
References cov, mapsmc, noval, nsmc, smcidx, constants::undef, wts, xidx, xspan, yidx, and yspan.
Referenced by w3s2xy_smc().
| subroutine w3smcomd::w3s2xy_smcrg_dir | ( | real, dimension(:), intent(in) | S, |
| real, dimension(nxo,nyo), intent(out) | XY | ||
| ) |
Regrid directional SMC data onto a regular grid.
Regrids directioanl scalar data from the SMC grid onto a regular grid. Uses pre-calculated grid indices and weights generated from the smc_interp() subroutine.
| [in] | S | Directional source field, on SMC grid. |
| [out] | XY | Storage for regridded field; must be 2D array with dimensions of (NXO,NYO). |
Definition at line 439 of file w3smcomd.F90.
References cov, mapsmc, noval, nsmc, constants::rade, smcidx, constants::undef, wts, xidx, xspan, yidx, and yspan.
Referenced by w3s2xy_smc().
| integer w3smcomd::celfac |
Output grid cell scaling factor; should be an integer power of 2.
Definition at line 92 of file w3smcomd.F90.
Referenced by smc_interp(), and w3ounf().
| integer w3smcomd::cfac |
SMC scaling factor (number of levels)
Definition at line 108 of file w3smcomd.F90.
Referenced by smc_interp().
| real, dimension(:,:), allocatable w3smcomd::cov |
Wet fraction (coverage) of cell.
Definition at line 98 of file w3smcomd.F90.
Referenced by mapsta_smc(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().
| real w3smcomd::dlat |
Base longitude cell size.
Definition at line 106 of file w3smcomd.F90.
Referenced by calc_interp(), and smc_interp().
| real w3smcomd::dlon |
Base latitude cell size.
Definition at line 107 of file w3smcomd.F90.
Referenced by calc_interp(), and smc_interp().
| double precision w3smcomd::dxo |
Output grid cell longitude size.
Definition at line 81 of file w3smcomd.F90.
Referenced by calc_interp(), read_smcint(), and smc_interp().
| double precision w3smcomd::dyo |
Output grid cell latitude size.
Definition at line 82 of file w3smcomd.F90.
Referenced by calc_interp(), read_smcint(), and smc_interp().
| double precision w3smcomd::exo |
Output grid final longitude.
Definition at line 79 of file w3smcomd.F90.
Referenced by smc_interp(), and w3ounf().
| double precision w3smcomd::eyo |
Output grid final latitude.
Definition at line 80 of file w3smcomd.F90.
Referenced by smc_interp(), and w3ounf().
| integer, dimension(:,:), allocatable w3smcomd::mapsmc |
Regridded MAPSTA.
Definition at line 99 of file w3smcomd.F90.
Referenced by mapsta_smc(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().
| integer w3smcomd::ndsmc |
ww3_smcint file unit number
Definition at line 116 of file w3smcomd.F90.
Referenced by read_smcint().
| integer, dimension(:,:), allocatable w3smcomd::nnidx |
Nearest neighbour SMC point to regular grid.
Definition at line 113 of file w3smcomd.F90.
Referenced by calc_interp(), read_smcint(), w3s2xy_smcnn(), and w3s2xy_smcnn_int().
| real w3smcomd::noval |
Fill value for seapoints with no value.
Definition at line 110 of file w3smcomd.F90.
Referenced by w3ounf(), w3s2xy_smcnn(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().
| integer w3smcomd::nsmc |
Number of SMC cells used in regridding.
Definition at line 120 of file w3smcomd.F90.
Referenced by smc_interp(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().
| integer w3smcomd::nxo |
Output grid number of longitude cells.
Definition at line 83 of file w3smcomd.F90.
Referenced by mapsta_smc(), read_smcint(), and smc_interp().
| integer w3smcomd::nyo |
Output grid number of latitude cells.
Definition at line 84 of file w3smcomd.F90.
Referenced by mapsta_smc(), read_smcint(), and smc_interp().
| integer, dimension(:), allocatable w3smcomd::smccx |
| integer, dimension(:), allocatable w3smcomd::smccy |
Latitude cell size factors.
Definition at line 105 of file w3smcomd.F90.
| integer, dimension(:), allocatable w3smcomd::smcidx |
Indices of SMC cells within output grid domain.
Definition at line 101 of file w3smcomd.F90.
Referenced by smc_interp(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().
| logical, dimension(:), allocatable w3smcomd::smcmask |
Mask for type 1 output (flat array)
Definition at line 100 of file w3smcomd.F90.
Referenced by smc_interp(), and w3s2xy_smc().
| integer w3smcomd::smcnout |
| integer w3smcomd::smcotype |
Type of SMC output: 1=seapoint grid of SMC cells; 2=regridding to regular grid; 3=interpolation to arbtrary grid; 4=nearest neighbour interpolation to arbitrary grid.
Definition at line 90 of file w3smcomd.F90.
Referenced by w3ounfmetamd::init_meta(), smc_interp(), w3ounf(), and w3s2xy_smc().
| double precision w3smcomd::sxo |
Output grid longitude origin.
Definition at line 77 of file w3smcomd.F90.
Referenced by calc_interp(), read_smcint(), smc_interp(), and w3ounf().
| double precision w3smcomd::syo |
Output grid latitude origin.
Definition at line 78 of file w3smcomd.F90.
Referenced by calc_interp(), read_smcint(), smc_interp(), and w3ounf().
| real, dimension(:), allocatable w3smcomd::wts |
Regridding weights.
Definition at line 97 of file w3smcomd.F90.
Referenced by mapsta_smc(), smc_interp(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().
| real, dimension(:,:), allocatable w3smcomd::xdist |
Lng.
distance to nearest neighbour
Definition at line 114 of file w3smcomd.F90.
Referenced by calc_interp(), read_smcint(), and w3s2xy_smcnn_int().
| integer, dimension(:), allocatable w3smcomd::xidx |
X-indices of SMC cells in regular grid.
Definition at line 93 of file w3smcomd.F90.
Referenced by mapsta_smc(), smc_interp(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().
| integer, dimension(:), allocatable w3smcomd::xspan |
Number of longitude cells SMC cell spans.
Definition at line 95 of file w3smcomd.F90.
Referenced by mapsta_smc(), smc_interp(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().
| real, dimension(:,:), allocatable w3smcomd::ydist |
Lat.
distance to nearest neighbour
Definition at line 115 of file w3smcomd.F90.
Referenced by calc_interp(), read_smcint(), and w3s2xy_smcnn_int().
| integer, dimension(:), allocatable w3smcomd::yidx |
Y-Indices of SMC cells in regular grid.
Definition at line 94 of file w3smcomd.F90.
Referenced by mapsta_smc(), smc_interp(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().
| integer, dimension(:), allocatable w3smcomd::yspan |
Number of longitude cells SMC cell spans.
Definition at line 96 of file w3smcomd.F90.
Referenced by mapsta_smc(), smc_interp(), w3s2xy_smcrg(), and w3s2xy_smcrg_dir().