-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHMC_Module_Data_Forcing_TimeSeries.f90
550 lines (440 loc) · 31.7 KB
/
HMC_Module_Data_Forcing_TimeSeries.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
!------------------------------------------------------------------------------------------
! File: HMC_Module_Data_Forcing_TimeSeries.f90
! Author(s): Fabio Delogu, Francesco Silvestro, Simone Gabellani
!
! Created on April 6, 2017, 4:33 PM
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Module Header
module HMC_Module_Data_Forcing_TimeSeries
!------------------------------------------------------------------------------------------
! External module(s) for all subroutine in this module
use HMC_Module_Namelist, only: oHMC_Namelist
use HMC_Module_Vars_Loader, only: oHMC_Vars
use HMC_Module_Tools_Debug
use HMC_Module_Tools_Generic, only: HMC_Tools_Generic_SmoothTimeSeries, &
HMC_Tools_Generic_ReplaceText
use HMC_Module_Tools_IO, only: HMC_Tools_IO_Get1d_ASCII
! Implicit none for all subroutines in this module
implicit none
!------------------------------------------------------------------------------------------
contains
!------------------------------------------------------------------------------------------
! Subroutine to manage forcing time-series data
subroutine HMC_Data_Forcing_TimeSeries_Cpl(iID, sTime, &
iNData, iETime, &
iNLake, iNDam, iNPlant, iNJoint, iNCatch, iNRelease)
!------------------------------------------------------------------------------------------
! Variable(s) declaration
integer(kind = 4) :: iID
character(len = 19) :: sTime
integer(kind = 4) :: iNData, iETime
integer(kind = 4) :: iNLake, iNDam, iNPlant, iNJoint, iNCatch, iNRelease
integer(kind = 4) :: iFlagTypeData_Forcing
character(len = 700) :: sPathData_Forcing
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Get global information
sPathData_Forcing = oHMC_Namelist(iID)%sPathData_Forcing_TimeSeries
iFlagTypeData_Forcing = oHMC_Namelist(iID)%iFlagTypeData_Forcing_TimeSeries
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Replace general path with specific time feature(s)
call HMC_Tools_Generic_ReplaceText(sPathData_Forcing, '$yyyy', sTime(1:4))
call HMC_Tools_Generic_ReplaceText(sPathData_Forcing, '$mm', sTime(6:7))
call HMC_Tools_Generic_ReplaceText(sPathData_Forcing, '$dd', sTime(9:10))
call HMC_Tools_Generic_ReplaceText(sPathData_Forcing, '$HH', sTime(12:13))
call HMC_Tools_Generic_ReplaceText(sPathData_Forcing, '$MM', sTime(15:16))
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Info start
call mprintf(.true., iINFO_Extra, ' Data :: Forcing time-series ... ' )
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Subroutine for reading sequential ASCII forcing data point
if (iFlagTypeData_Forcing == 1) then
!------------------------------------------------------------------------------------------
! Check logical variable to control forcing point section (2d array)
if (.not. oHMC_Vars(iID)%bFileForcingTimeSeries) then
!------------------------------------------------------------------------------------------
! Get point time-series for plant(s)
call HMC_Data_Forcing_TimeSeries_Plant(iID, iNPlant, iNData, iETime)
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Get point time-series for intake(s)
call HMC_Data_Forcing_TimeSeries_Intake(iID, iNCatch, iNRelease, iNData, iETime)
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Update logical variable to control forcing point section
oHMC_Vars(iID)%bFileForcingTimeSeries = .true.
!------------------------------------------------------------------------------------------
else
!------------------------------------------------------------------------------------------
! Info forcing point data
call mprintf(.true., iINFO_Extra, ' Forcing point data (plant, intake) loaded previously! Skipping this step!')
! Info end
call mprintf(.true., iINFO_Extra, ' Data :: Forcing time-series ... SKIPPED!' )
!------------------------------------------------------------------------------------------
endif
endif
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Subroutine for reading unknown forcing data time-series
if (iFlagTypeData_Forcing .ne. 1) then
!------------------------------------------------------------------------------------------
! Choosing data type
call mprintf(.true., iERROR, ' Using UNKNOWN data time-series forcing. Check settings file!')
!------------------------------------------------------------------------------------------
endif
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Info end
call mprintf(.true., iINFO_Extra, ' Data :: Forcing time-series ... OK' )
!------------------------------------------------------------------------------------------
end subroutine HMC_Data_Forcing_TimeSeries_Cpl
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Subroutine to get time series of plant(s)
subroutine HMC_Data_Forcing_TimeSeries_Plant(iID, iNPlant, iNData, iETime)
!------------------------------------------------------------------------------------------
! Variable(s) declaration
integer(kind = 4) :: iID
integer(kind = 4) :: iP, iI, iJ, iErr
integer(kind = 4) :: iNPlant, iNData, iDtDataForcing, iETime
real(kind = 4) :: dVarAreaCell
character(len = 256) :: sPathData
character(len = 256) :: sNamePlant
character(len = 256) :: sFilePlant
real(kind = 4), dimension(iNData) :: a1dVar, a1dVarHydro
real(kind = 4), dimension(iNPlant, iETime + 1) :: a2dVarHydro
logical :: bFileExist
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Initialize variable(s)
a1dVar = 0.0; a1dVarHydro = 0.0
a2dVarHydro = 0.0;
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Info start
call mprintf(.true., iINFO_Extra, ' Data :: Forcing time-series :: ASCII :: Plant ... ')
! Debug
call mprintf(.true., iINFO_Extra, checkarray(a2dVarHydro(:,2), 'HYDRO PLANT START') )
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Check plant(s) availability
if (iNPlant .gt. 0) then
!------------------------------------------------------------------------------------------
! Get global information
sPathData = oHMC_Namelist(iID)%sPathData_Forcing_TimeSeries
iDtDataForcing = oHMC_Namelist(iID)%iDtData_Forcing
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Cycle on plant(s)
do iP = 1, iNPlant
!------------------------------------------------------------------------------------------
! Initialize step variable(s)
a1dVar = 0.0; iI = 0; iJ = 0; dVarAreaCell = 0.0
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Get global information
iI = oHMC_Vars(iID)%a2iXYPlant(iP,2); iJ = oHMC_Vars(iID)%a2iXYPlant(iP,1);
dVarAreaCell = oHMC_Vars(iID)%a2dAreaCell(iI, iJ)
! Plant name and filename data
sNamePlant = oHMC_Vars(iID)%a1sNamePlant(iP)
sFilePlant = trim(sPathData)//'hmc.forcing-ts.plant_'//trim(sNamePlant)//'.txt'
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Check area cell
if (dVarAreaCell.lt.0) then
call mprintf(.true., iWARN, &
' Area cell for '//trim(sNamePlant)//' plant is undefined! Model will use a default value!')
dVarAreaCell = oHMC_Vars(iID)%dDxM*oHMC_Vars(iID)%dDyM
endif
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Info file
call mprintf(.true., iINFO_Extra, ' Get filename (plant forcing time-series): '//trim(sFilePlant) )
! Check file availability
inquire (file = sFilePlant, exist = bFileExist)
if ( .not. bFileExist ) then
!------------------------------------------------------------------------------------------
! Warning message
call mprintf(.true., iWARN, ' No forcing time-series ASCII data found (plant): '//trim(sFilePlant) )
! Info filename
call mprintf(.true., iINFO_Verbose, &
' Get filename (plant forcing time-series): '//trim(sFilePlant)//' ... FAILED')
! No data values
a2dVarHydro(iP, :) = -9999.0 ! NoData dam value == -9999.0 NOT CHANGE
!------------------------------------------------------------------------------------------
else
!------------------------------------------------------------------------------------------
! Read ASCII file
call HMC_Tools_IO_Get1d_ASCII(sFilePlant, a1dVar, iNData, .false. , iErr)
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Check data
if (.not. all(a1dVar.eq.-9999.0) ) then
!------------------------------------------------------------------------------------------
! Control data
where (a1dVar .gt. 0.0)
! from m^3/s to mm/h
a1dVarHydro = a1dVar*1000*dble(iDtDataForcing)/dVarAreaCell
elsewhere
a1dVarHydro = 0.0
endwhere
! Smooth data
!call HMC_Tools_Generic_SmoothTimeSeries(a1dVarHydro, iNData, 2)
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Save data for each dam in one workspace (from start to simulation length)
a2dVarHydro(iP, 1 : iNData) = a1dVarHydro
! No data condition for extra time steps
if (iNData .lt. iETime) then
a2dVarHydro(iP, iNData + 1 : iETime + 1) = 0.0 ! Set to zero for value in extra time step(s)
endif
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
else
!------------------------------------------------------------------------------------------
! No data available
call mprintf(.true., iWARN, ' All plant values are undefined!')
a2dVarHydro(iP, :) = -9999.0 ! NoData dam value == -9999.0 NOT CHANGE
!------------------------------------------------------------------------------------------
endif
!------------------------------------------------------------------------------------------
endif
!------------------------------------------------------------------------------------------
enddo
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Info end
call mprintf(.true., iINFO_Extra, ' Data :: Forcing time-series :: ASCII :: Plant ... OK')
!------------------------------------------------------------------------------------------
else
!------------------------------------------------------------------------------------------
! No plant(s)
a2dVarHydro = -9999.0 ! NoData dam value == -9999.0 NOT CHANGE
! Info end
call mprintf(.true., iINFO_Extra, ' Data :: Forcing time-series :: ASCII :: Plant ... SKIPPED')
!------------------------------------------------------------------------------------------
endif
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Debug
call mprintf(.true., iINFO_Extra, checkarray(a2dVarHydro(:,2), 'HYDRO PLANT END') )
! Pass local variable(s) to global workspace
oHMC_Vars(iID)%a2dHydroPlant = a2dVarHydro
!------------------------------------------------------------------------------------------
end subroutine HMC_Data_Forcing_TimeSeries_Plant
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Subroutine to get time series of intake(s)
subroutine HMC_Data_Forcing_TimeSeries_Intake(iID, iNCatch, iNRelease, iNData, iETime)
!------------------------------------------------------------------------------------------
! Variable(s) declaration
integer(kind = 4) :: iID
integer(kind = 4) :: iR, iP, iStep, iI, iJ, iErr, iTimeShift, iETime
integer(kind = 4) :: iNCatch, iNRelease, iNData, iDtDataForcing
integer(kind = 4) :: iLenStr
real(kind = 4) :: dAreaCell, dTCorrCatch, dWeigthCatch
real(kind = 4) :: dQMaxRelease
character(len = 256) :: sPathData
character(len = 256) :: sNameRelease, sNameCatch
character(len = 256) :: sFileRelease
character(len = 256), dimension(iNData) :: a1sVar
real(kind = 4), dimension(iNData) :: a1dVar
real(kind = 4), dimension(iNData) :: a1dVarHydroO
real(kind = 4), dimension(iNData) :: a1dVarHydroR
real(kind = 4), dimension(iNData) :: a1dVarHydroC
real(kind = 4), dimension(iNRelease, iETime + 1) :: a2dVarHydroR
real(kind = 4), dimension(iNCatch, iETime + 1) :: a2dVarHydroC
logical, dimension(iNCatch) :: a1bVarCheck
logical :: bFileExist
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Initialize variable(s)
a1sVar = ''; a1dVar = 0.0;
a1dVarHydroO = 0.0; a1dVarHydroR = 0.0; a1dVarHydroC = 0.0;
a2dVarHydroR = 0.0; a2dVarHydroC = 0.0;
a1bVarCheck = .false.
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Info start
call mprintf(.true., iINFO_Extra, ' Data :: Forcing time-series :: ASCII :: Intake (Releases and Catches) ... ')
! Debug
call mprintf(.true., iINFO_Extra, checkarray(a2dVarHydroC(:,2), 'HYDRO CATCH START') )
call mprintf(.true., iINFO_Extra, checkarray(a2dVarHydroR(:,2), 'HYDRO RELEASE START') )
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Check release(s) availability
if (iNRelease .gt. 0) then
!------------------------------------------------------------------------------------------
! Get global information
sPathData = oHMC_Namelist(iID)%sPathData_Forcing_TimeSeries
iDtDataForcing = oHMC_Namelist(iID)%iDtData_Forcing
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Cycle on release(s)
do iR = 1, iNRelease
!------------------------------------------------------------------------------------------
! Initialize step variable(s)
a1dVar = -9999.0; iI = 0; iJ = 0; dAreaCell = 0.0
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Get global information
iI = oHMC_Vars(iID)%a2iXYRelease(iR,2); iJ = oHMC_Vars(iID)%a2iXYRelease(iR,1);
dAreaCell = oHMC_Vars(iID)%a2dAreaCell(iI, iJ)
dQMaxRelease = oHMC_Vars(iID)%a1dQMaxRelease(iR)
! Release name and filename data
sNameRelease = oHMC_Vars(iID)%a1sNameRelease(iR)
sFileRelease = trim(sPathData)//'hmc.forcing-ts.plant_'//trim(sNameRelease)//'.txt'
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Check area cell
if (dAreaCell.lt.0) then
call mprintf(.true., iWARN, &
' Area cell for '//trim(sNameRelease)//' release is undefined! Model will use a default value!')
dAreaCell = oHMC_Vars(iID)%dDxM*oHMC_Vars(iID)%dDyM
endif
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Info file
call mprintf(.true., iINFO_Extra, ' Get filename (intake forcing time-series): '//trim(sFileRelease) )
! Check file availability
inquire (file = sFileRelease, exist = bFileExist)
if ( .not. bFileExist ) then
!------------------------------------------------------------------------------------------
! Warning message
call mprintf(.true., iWARN, &
' No forcing time-series ASCII data found (release): '//trim(sFileRelease)//';'// &
' model will use 80% of max release discharge!')
! Info filename
call mprintf(.true., iINFO_Verbose, &
' Get filename (intake forcing time-series): '//trim(sFileRelease)//' ... FAILED')
! Default value if plant data file is not available
a1dVarHydroO = dQMaxRelease*0.8 ! m^3/s
a1dVarHydroR = dQMaxRelease*1000*real(iDtDataForcing)/dAreaCell*0.8 ! from m^3/s to mm/h
!------------------------------------------------------------------------------------------
else
!------------------------------------------------------------------------------------------
! Read ASCII file
call HMC_Tools_IO_Get1d_ASCII(sFileRelease, a1dVar, iNData, .false. , iErr)
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Check data
if (.not. all(a1dVar.eq.-9999.)) then
!------------------------------------------------------------------------------------------
! Control data
where (a1dVar .gt. 0.0)
a1dVarHydroO = a1dVar*1.0 ! m^3/s
a1dVarHydroR = a1dVar*1000*real(iDtDataForcing)/dAreaCell ! from m^3/s to mm/h
elsewhere
a1dVarHydroO = 0.0
a1dVarHydroR = 0.0
endwhere
! Smooth timeseries data
!call HMC_Tools_Generic_SmoothTimeSeries(a1dVarHydroO, iNData, 3)
!call HMC_Tools_Generic_SmoothTimeSeries(a1dVarHydroR, iNData, 3)
!------------------------------------------------------------------------------------------
else
!------------------------------------------------------------------------------------------
! No data available
call mprintf(.true., iWARN, ' All catch(es) values are undefined! Check forcing data!')
a1dVarHydroO = 0.0
a1dVarHydroR = 0.0
!------------------------------------------------------------------------------------------
endif
!------------------------------------------------------------------------------------------
endif
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Cycle on catch(es)
do iP = 1, iNCatch
!------------------------------------------------------------------------------------------
! Get release and catch name
sNameRelease = oHMC_Vars(iID)%a1sNameRelease(iR)
sNameCatch = oHMC_Vars(iID)%a1sNameCatch(iP)
iLenStr = len(trim(sNameRelease))
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Check release and catch name(s9
if ( sNameRelease(1:iLenStr) .eq. sNameCatch(1:iLenStr) ) then
!------------------------------------------------------------------------------------------
! Get info catch
dTCorrCatch = oHMC_Vars(iID)%a1dTCorrCatch(iP)
dWeigthCatch = oHMC_Vars(iID)%a1dWeigthCatch(iP)
iTimeShift = nint(dTCorrCatch*60/iDtDataForcing)
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Compute hydro arrays for catch(es)
do iStep = 1, iNData - 1
if ( (iStep - iTimeShift).ge.1 ) then
a1dVarHydroC(iStep - iTimeShift) = a1dVarHydroO(iStep)*dWeigthCatch ! [m^3/s]
endif
enddo
do iStep = iNData - 1 - iTimeShift, iNData - 1
a1dVarHydroC(iStep) = a1dVarHydroO(iNData - 1)*dWeigthCatch
enddo
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Save data for each catch in one workspace (from start to simulation length)
a2dVarHydroC(iP, 1 : iNData) = a1dVarHydroC
! No data condition for extra time steps
if (iNData .lt. iETime) then
a2dVarHydroC(iP, iNData + 1 : iETime + 1) = 0.0
endif
a1bVarCheck(iP) = .true.
!------------------------------------------------------------------------------------------
else
!------------------------------------------------------------------------------------------
! Link between release and catch does not exist
a1bVarCheck(iP) = .false.
!------------------------------------------------------------------------------------------
endif
!------------------------------------------------------------------------------------------
enddo
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Check link(s)
if (all(a1bVarCheck .eqv. .false.)) then
call mprintf(.true., iWARN, &
' Release '//trim(sNameRelease)//' does not have a catch! '// &
' Check time-series forcing data (catch)!')
endif
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Save data for each release in one workspace (from start to simulation length)
a2dVarHydroR(iR, 1 : iNData) = a1dVarHydroR
! No data condition for extra time steps
if (iNData .lt. iETime) then
a2dVarHydroR(iR, iNData + 1 : iETime + 1) = 0.0
endif
!------------------------------------------------------------------------------------------
enddo
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Info end
call mprintf(.true., iINFO_Extra, ' Data :: Forcing time-series :: ASCII :: Intake (Releases and Catches) ... OK')
!------------------------------------------------------------------------------------------
else
!------------------------------------------------------------------------------------------
! No release(s) and no catch(es)
a2dVarHydroR = 0.0
a2dVarHydroC = 0.0
! Info end
call mprintf(.true., iINFO_Extra, ' Data :: Forcing time-series :: ASCII :: Intake (Releases and Catches) ... SKIPPED')
!------------------------------------------------------------------------------------------
endif
!------------------------------------------------------------------------------------------
!------------------------------------------------------------------------------------------
! Debug
call mprintf(.true., iINFO_Extra, checkarray(a2dVarHydroC(:,2), 'HYDRO CATCH END') )
call mprintf(.true., iINFO_Extra, checkarray(a2dVarHydroR(:,2), 'HYDRO RELEASE END') )
! Pass local variable(s) to global workspace
oHMC_Vars(iID)%a2dHydroRelease = a2dVarHydroR
oHMC_Vars(iID)%a2dHydroCatch = a2dVarHydroC
!------------------------------------------------------------------------------------------
end subroutine HMC_Data_Forcing_TimeSeries_Intake
!------------------------------------------------------------------------------------------
end module HMC_Module_Data_Forcing_TimeSeries
!------------------------------------------------------------------------------------------