Changeset 708c667 in flex_extract.git for source/python/mods/disaggregation.py
- Timestamp:
- Oct 18, 2018, 2:44:55 PM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 274f9ef
- Parents:
- e585e1b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/python/mods/disaggregation.py
rae88f7d r708c667 52 52 # ------------------------------------------------------------------------------ 53 53 def dapoly(alist): 54 ''' 55 @Author: P. JAMES 56 57 @Date: 2000-03-29 58 59 @ChangeHistory: 60 June 2003 - A. BECK (2003-06-01) 61 adaptaions 62 November 2015 - Leopold Haimberger (University of Vienna) 63 migration from Fortran to Python 64 65 @Description: 66 Interpolation of deaccumulated fluxes of an ECMWF model FG field 67 using a cubic polynomial solution which conserves the integrals 68 of the fluxes within each timespan. 69 disaggregationregation is done for 4 accumluated timespans which generates 70 a new, disaggregated value which is output at the central point 71 of the 4 accumulation timespans. This new point is used for linear 72 interpolation of the complete timeseries afterwards. 73 74 @Input: 75 alist: list of size 4, array(2D), type=float 76 List of 4 timespans as 2-dimensional, horizontal fields. 77 E.g. [[array_t1], [array_t2], [array_t3], [array_t4]] 78 79 @Return: 80 nfield: array(2D), type=float 81 New field which replaces the field at the second position 82 of the accumulation timespans. 83 84 ''' 54 """Cubic polynomial interpolation of deaccumulated fluxes. 55 56 Interpolation of deaccumulated fluxes of an ECMWF model FG field 57 using a cubic polynomial solution which conserves the integrals 58 of the fluxes within each timespan. 59 Disaggregation is done for 4 accumluated timespans which 60 generates a new, disaggregated value which is output at the 61 central point of the 4 accumulation timespans. 62 This new point is used for linear interpolation of the complete 63 timeseries afterwards. 64 65 Parameters 66 ---------- 67 alist : :obj:`list` of :obj:`array` of :obj:`float` 68 List of 4 timespans as 2-dimensional, horizontal fields. 69 E.g. [[array_t1], [array_t2], [array_t3], [array_t4]] 70 71 Return 72 ------ 73 nfield : :obj:`array` of :obj:`float` 74 Interpolated flux at central point of accumulation timespan. 75 76 Note 77 ---- 78 March 2000 : P. JAMES 79 Original author 80 81 June 2003 : A. BECK 82 Adaptations 83 84 November 2015 : Leopold Haimberger (University of Vienna) 85 Migration from Fortran to Python 86 87 """ 88 85 89 pya = (alist[3] - alist[0] + 3. * (alist[1] - alist[2])) / 6. 86 90 pyb = (alist[2] + alist[0]) / 2. - alist[1] - 9. * pya / 2. … … 93 97 94 98 def darain(alist): 95 ''' 96 @Author: P. JAMES 97 98 @Date: 2000-03-29 99 100 @ChangeHistory: 101 June 2003 - A. BECK (2003-06-01) 102 adaptaions 103 November 2015 - Leopold Haimberger (University of Vienna) 104 migration from Fortran to Python 105 106 @Description: 107 Interpolation of deaccumulated fluxes of an ECMWF model FG rainfall 108 field using a modified linear solution which conserves the integrals 109 of the fluxes within each timespan. 110 disaggregationregation is done for 4 accumluated timespans which generates 111 a new, disaggregated value which is output at the central point 112 of the 4 accumulation timespans. This new point is used for linear 113 interpolation of the complete timeseries afterwards. 114 115 @Input: 116 alist: list of size 4, array(2D), type=float 117 List of 4 timespans as 2-dimensional, horizontal fields. 118 E.g. [[array_t1], [array_t2], [array_t3], [array_t4]] 119 120 @Return: 121 nfield: array(2D), type=float 122 New field which replaces the field at the second position 123 of the accumulation timespans. 124 ''' 99 """Linear interpolation of deaccumulated fluxes. 100 101 Interpolation of deaccumulated fluxes of an ECMWF model FG rainfall 102 field using a modified linear solution which conserves the integrals 103 of the fluxes within each timespan. 104 Disaggregation is done for 4 accumluated timespans which generates 105 a new, disaggregated value which is output at the central point 106 of the 4 accumulation timespans. This new point is used for linear 107 interpolation of the complete timeseries afterwards. 108 109 Parameters 110 ---------- 111 alist : :obj:`list` of :obj:`array` of :obj:`float` 112 List of 4 timespans as 2-dimensional, horizontal fields. 113 E.g. [[array_t1], [array_t2], [array_t3], [array_t4]] 114 115 Return 116 ------ 117 nfield : :obj:`array` of :obj:`float` 118 Interpolated flux at central point of accumulation timespan. 119 120 Note 121 ---- 122 March 2000 : P. JAMES 123 Original author 124 125 June 2003 : A. BECK 126 Adaptations 127 128 November 2015 : Leopold Haimberger (University of Vienna) 129 Migration from Fortran to Python 130 """ 131 125 132 xa = alist[0] 126 133 xb = alist[1] … … 143 150 144 151 def IA3(g): 145 """ 146 147 *************************************************************************** 148 * Copyright 2017 * 149 * Sabine Hittmeir, Anne Philipp, Petra Seibert * 150 * * 151 * This work is licensed under the Creative Commons Attribution 4.0 * 152 * International License. To view a copy of this license, visit * 153 * http://creativecommons.org/licenses/by/4.0/ or send a letter to * 154 * Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. * 155 *************************************************************************** 156 157 @Description 158 The given data series will be interpolated with a non-negative geometric 159 mean based algorithm. The original grid is reconstructed by adding two 160 sampling points in each data series interval. This subgrid is used to 161 keep all information during the interpolation within the associated 162 interval. Additionally, an advanced monotonicity filter is applied to 163 improve the monotonicity properties of the series. 164 165 For more information see article: 166 Hittmeir, S.; Philipp, A.; Seibert, P. (2017): A conservative 167 interpolation scheme for extensive quantities with application to the 168 Lagrangian particle dispersion model FLEXPART., 169 Geoscientific Model Development 170 171 @Input 172 g: list of float values 173 A list of float values which represents the complete data series that 174 will be interpolated having the dimension of the original raw series. 175 176 @Return 177 f: list of float values 178 The interpolated data series with additional subgrid points. 179 Its dimension is equal to the length of the input data series 180 times three. 152 """ Interpolation with a non-negative geometric mean based algorithm. 153 154 The original grid is reconstructed by adding two sampling points in each 155 data series interval. This subgrid is used to keep all information during 156 the interpolation within the associated interval. Additionally, an advanced 157 monotonicity filter is applied to improve the monotonicity properties of 158 the series. 159 160 Note 161 ---- 162 Copyright 2017 163 Sabine Hittmeir, Anne Philipp, Petra Seibert 164 165 This work is licensed under the Creative Commons Attribution 4.0 166 International License. To view a copy of this license, visit 167 http://creativecommons.org/licenses/by/4.0/ or send a letter to 168 Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. 169 170 Parameters 171 ---------- 172 g : :obj:`list` of :obj:`float` 173 Complete data series that will be interpolated having 174 the dimension of the original raw series. 175 176 Return 177 ------ 178 f : :obj:`list` of :obj:`float` 179 The interpolated data series with additional subgrid points. 180 Its dimension is equal to the length of the input data series 181 times three. 182 183 184 References 185 ---------- 186 For more information see article: 187 Hittmeir, S.; Philipp, A.; Seibert, P. (2017): A conservative 188 interpolation scheme for extensive quantities with application to the 189 Lagrangian particle dispersion model FLEXPART., 190 Geoscientific Model Development 181 191 """ 182 192
Note: See TracChangeset
for help on using the changeset viewer.