Feel free to join the next Helmholtz Hacky Hour #30 on Wednesday, June 16, 2021 from 2PM to 3PM!

Commit 49a74a5a authored by Friedrich Boeing's avatar Friedrich Boeing
Browse files

added option to invert y dimension (currently: invert_y = .True. in edk.nml...

added option to invert y dimension (currently: invert_y = .True. in edk.nml for mHM compatible input)
parent c70f3bcc
......@@ -59,7 +59,7 @@ flagVario = .False.
!
! number of variogram parameters
nParam = 3
! type of theoritical variogramm (1=spherical, 2 = exponential)
! type of theoretical variogramm (1=spherical, 2 = exponential)
vType = 2
!
! file name where to store the variogram parameters
......@@ -69,9 +69,10 @@ fNameVario = "check/var_param_de_pre.txt"
dh = 1.0e3 ! binsize for variogram [m]
hMax = 1.5e5 ! max distance h for variogram estimation [m]
! -------------------------------------------------------------------
! --------------- NC OUPUT SPECIFICATION ----------------------------
! --------------- NC OUTPUT SPECIFICATION ----------------------------
author_name = 'XXX'
projection_name = 'EPSG: 31468'
invert_y = .True. ! (set True if working with mHM input data!)
variable_name = 'pre'
variable_unit = 'mm/d'
variable_long_name = 'daily precipitation'
......
......@@ -36,6 +36,7 @@ program ED_Kriging
use mo_message , only: message
use mo_EDK , only: EDK
use mo_ReadData , only: readData
use NetCDFVar , only: invert_y
USE mo_timer, ONLY : &
timers_init, timer_start, timer_stop, timer_get ! Timing of processes
use mo_string_utils, ONLY : num2str
......@@ -149,10 +150,22 @@ program ED_Kriging
k = 0
do i = 1, gridMeteo%ncols
do j = 1, gridMeteo%nrows
k = k + 1
tmp_array(i, gridMeteo%nrows - j + 1, :) = cell(k)%z
end do
! do j = 1, gridMeteo%nrows
! k = k + 1
! tmp_array(i, gridMeteo%nrows - j + 1, :) = cell(k)%z
! end do
! end do
if (invert_y) then
do j = gridMeteo%nrows, 1, -1
k = k + 1
tmp_array(i, gridMeteo%nrows - j + 1, :) = cell(k)%z
end do
else
do j = 1, gridMeteo%nrows
k = k + 1
tmp_array(i, gridMeteo%nrows - j + 1, :) = cell(k)%z
end do
end if
end do
t = 0
do i = 1, jEnd - jStart + 1
......
......@@ -36,7 +36,7 @@ contains
use runControl, only: interMth, fnameDEM, DataPathOut, DataPathIn, fNameSta, correctNeg, &
distZero, flagVario, fNameVario, flagEDK
use NetCDFVar, only: FileOut, author_name, projection_name, variable_name, variable_unit, &
variable_long_name, ncIn_variable_name, ncIn_yCoord_name, ncIn_xCoord_name
variable_long_name, ncIn_variable_name, ncIn_yCoord_name, ncIn_xCoord_name, invert_y
use mo_message, only: message
use mo_string_utils, only: divide_string
......@@ -51,11 +51,11 @@ contains
! namelist definition
!===============================================================
!
namelist/mainVars/noDataValue, DataPathIn, fNameDEM, &
namelist/mainVars/noDataValue, DataPathIn, fNameDEM, &
DataPathOut, FileOut, fNameSTA, cellFactor, DataConvertFactor, InterMth, correctNeg, &
distZero, author_name, projection_name, variable_name, variable_unit, variable_long_name, &
yStart, mStart, dStart, yEnd, mEnd, dEnd, maxDist, flagVario, vType, nParam, &
fNameVario, dh, hMax, ncIn_variable_name, ncIn_yCoord_name, ncIn_xCoord_name
fNameVario, dh, hMax, ncIn_variable_name, ncIn_yCoord_name, ncIn_xCoord_name, invert_y
!
! -----------------------------------------------------------------------
! MAIN.DAT
......
......@@ -14,7 +14,7 @@ CONTAINS
use mo_netcdf, only: NcDataset, NcDimension, NcVariable
use mo_string_utils, only: num2str
use mainVar, only: gridMeteo, yStart, mStart, dStart
use NetCDFVar, only: fileOut, author_name, variable_name, variable_unit, variable_long_name, projection_name
use NetCDFVar, only: fileOut, author_name, variable_name, variable_unit, variable_long_name, projection_name,invert_y
implicit none
......@@ -23,7 +23,7 @@ CONTAINS
type(NcDimension) :: dim_x, dim_y, dim_time
type(NcVariable) :: var_east, var_north
integer(i4) :: i
integer(i4) :: i, f
real(dp), allocatable :: dummy(:, :)
! 1.1 create a file
......@@ -42,9 +42,17 @@ CONTAINS
trim(num2str(dStart, form='(I0.2)')) // "-" // "00:00:00")
allocate(dummy(gridMeteo%ncols, gridMeteo%nrows))
do i = 1, gridMeteo%nrows
dummy(:, i) = gridMeteo%yllcorner + (real(i,dp) - 0.5_dp) * gridMeteo%cellsize
end do
if (invert_y) then
f = 1
do i = gridMeteo%nrows, 1, -1
dummy(:, i) = gridMeteo%yllcorner + (real(f,dp) - 0.5_dp) * gridMeteo%cellsize
f = f + 1
end do
else
do i = 1, gridMeteo%nrows
dummy(:, i) = gridMeteo%yllcorner + (real(i,dp) - 0.5_dp) * gridMeteo%cellsize
end do
end if
var_north = nc%setVariable('northing', "f32", (/dim_x, dim_y/))
call var_north%setAttribute("standard_name", "northing")
call var_north%setAttribute("units", "m")
......
......@@ -183,6 +183,7 @@ module NetCDFVar
character(256) :: variable_long_name ! long name of netcdf variable
character(256) :: author_name ! author name of netcdf file
character(256) :: projection_name ! name of EPSG (EPSG:XXXX)
logical :: invert_y
!
! netcdf input specifications
character(256) :: ncIn_variable_name
......
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