Commit 09813b79 authored by Sebastian Müller's avatar Sebastian Müller 🎸

modules: replace dCS, dS and dz2S with the new distance-class in global variables

parent 52ce895d
!******************************************************************************
!******************************************************************************
! MODULES for EDK
! AUTHOR Luis Samaniego (UFZ)
! DESCRIPTION
......@@ -25,18 +25,18 @@ module mainVar
integer(i4) :: nSta ! number of stations for a block
integer(i4) :: nCell ! number of cells to estimate z
integer(i4) :: cellFactor ! > 1 , size grid metereological data
integer(i4) :: DEMNcFlag ! flag for DEM format 0 = text file, 1 = netCDF
integer(i4) :: DEMNcFlag ! flag for DEM format 0 = text file, 1 = netCDF
real(dp) :: DataConvertFactor ! precipitation & temperature(in 1/10 mm) **** only in NECKAR BASIN *****
real(dp) :: OffSet ! constant to be added (Ex: add 273 to convert tavg from C to K )
real(dp) :: noDataValue
real(dp) :: thresholdDist ! treshold cellsize distance
real(dp) :: OffSet ! constant to be added (Ex: add 273 to convert tavg from C to K )
real(dp) :: noDataValue
real(dp) :: thresholdDist ! treshold cellsize distance
! constants
real(dp), parameter :: DayHours = 24.0_dp ! hours per day
real(dp), parameter :: YearDays = 365.0_dp ! days in a year
real(dp), parameter :: DaySecs = 86400.0_dp ! sec in a day
! data input
type CellFiner
real(dp) :: h ! elevation (sinks removed) [m]
real(dp) :: h ! elevation (sinks removed) [m]
end type CellFiner
type(CellFiner), dimension(:,:), allocatable :: G ! Cell characteristics
type MeteoStation
......@@ -45,8 +45,8 @@ module mainVar
real(dp) :: y ! y coordinate
real(dp) :: h ! elevation
real(dp), dimension(:), allocatable :: z ! observed daily value (prec. temp, etc)
end type MeteoStation
type(MeteoStation), dimension(:), allocatable :: MetSta
end type MeteoStation
type(MeteoStation), dimension(:), allocatable :: MetSta
! GRID description
type gridGeoRef
......@@ -58,7 +58,7 @@ module mainVar
integer(i4) :: nodata_value ! code to define the mask
real(dp), dimension(:,:), allocatable :: easting ! irregular grid easting
real(dp), dimension(:,:), allocatable :: northing ! irregular grid northing
real(dp), dimension(:), allocatable :: latitude ! latitude for the output
real(dp), dimension(:), allocatable :: latitude ! latitude for the output
real(dp), dimension(:), allocatable :: longitude ! longitude for the output
end type gridGeoRef
type (gridGeoRef) :: grid
......@@ -88,7 +88,7 @@ contains
use mo_julian, only: julday
implicit none
class(period), intent(inout) :: self
integer(i4), intent(in) :: dStart, mStart, yStart, dEnd, mEnd, yEnd
......@@ -102,7 +102,7 @@ contains
self%julStart = julday(dd = dStart, mm = mStart, yy = yStart)
self%julEnd = julday(dd = dEnd, mm = mEnd, yy = yEnd)
self%nObs = self%julEnd - self%julStart + 1_i4
end subroutine init
end module mainVar
......@@ -132,6 +132,7 @@ end module runControl
module kriging
use mo_kind, only: i4, sp, dp
use mainVar, only: nSta
use mo_edk_types, only: dist_t
real(dp) :: maxDist ! max distance [m] search stations
type CellCoarser
integer(i4) :: nNS ! No. Nearest Stations (NS) d <= maxDist
......@@ -143,23 +144,18 @@ module kriging
real(sp), allocatable :: z(:) ! z values to be interpolated (OUTPUT)
real(dp), allocatable :: W(:)
end type CellCoarser
type(CellCoarser), dimension(:), allocatable :: cell ! EDK output
real(dp), dimension(:,:), allocatable :: dCS ! Euclidean distance between cells -> stations
type dtoS
real(dp), dimension(:), allocatable :: S ! distance to Station j
end type dtoS
type (dtoS), dimension(:), allocatable :: dS ! distance from Station i to all js
type (dtoS), dimension(:), allocatable :: dz2S ! squared diference of Z values
real(dp) :: xl, xr, yd, yu ! coordinates of the interpolation block
!real(dp) , allocatable :: X(:)
type(CellCoarser), dimension(:), allocatable :: cell ! EDK output
type(dist_t) :: edk_dist ! distance calculations for EDK
real(dp) :: xl, xr, yd, yu ! coordinates of the interpolation block
!real(dp) , allocatable :: X(:)
!
end module kriging
module VarFit
use mo_kind, only: i4, dp
implicit none
! parameters
! parameters
integer(i4) :: vType ! variogram type
integer(i4) :: nParam ! number of parameters
integer(i4), dimension(:), allocatable :: Nh ! number of pairs per bin
......@@ -172,7 +168,7 @@ module VarFit
real(dp) :: gmax(2)
real(dp) :: m0
real(dp) :: v0
real(dp), dimension(:), allocatable :: beta ! parameters of the variogram
real(dp), dimension(:), allocatable :: beta ! parameters of the variogram
real(dp), dimension(8) :: E ! efficiency measures
real(dp), parameter :: sRadius = 1.d4 ! searching distance limits
real(dp), parameter :: gradE = 2.d-1 ! gradient limit = delta E / distance (searching)
......@@ -186,7 +182,7 @@ module NetCDFVar
character(256) :: fileOut ! File Name out
real(dp), dimension(:), allocatable, target :: yCoor ! GK4 (DHDN3-zone 4) easting
real(dp), dimension(:), allocatable, target :: xCoor ! GK4 (DHDN3-zone 4) northing
real(dp), dimension(:,:), allocatable, target :: lons ! WGS84 lons
real(dp), dimension(:,:), allocatable, target :: lons ! WGS84 lons
real(dp), dimension(:,:), allocatable, target :: lats ! WGS84 lats
!
character(256) :: variable_name ! name of netcdf variable
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment