Feel free to join the next Helmholtz Hacky Hour #26 on Wednesday, April 21, 2021 from 2PM to 3PM!

Commit a1244f20 authored by Akash Koppa's avatar Akash Koppa

added a namelist variable 'OffSet' to enable temperature unit conversion (ex: Celsius to Kelvin)

parent 0447382f
This diff is collapsed.
......@@ -42,7 +42,13 @@ FileOut = "edk.nc"
!
! Name of Look Up Table of Station data
fNameSTA = "check/pre_data/Stations_in_study_domain.txt"
! The value that should be multiplied to the data in the netcdf file
DataConvertFactor = 1.0e-1
! The value that should be added to the data in the netcdf file
OffSet = 0
![FINAL VALUE = NETCDF VALUE * DataConvertFactor + OffSet]
!
! -------------------------------------------------------------------
! ------------ PROCESSING PERIOD ------------------------------------
......
......@@ -26,7 +26,7 @@ contains
! Last Update Sa 11.06.2010
!**************************************************************************
subroutine ReadData()
use mainVar, only: noDataValue, cellFactor, DataConvertFactor, &
use mainVar, only: noDataValue, cellFactor, DataConvertFactor, OffSet, &
yStart, mStart, dStart, yEnd, mEnd, dEnd, tBuffer,DEMNcFlag
use mo_kind, only: i4, dp
use mo_julian , only: NDAYS
......@@ -55,7 +55,7 @@ contains
!===============================================================
!
namelist/mainVars/noDataValue, DataPathIn, fNameDEM, &
DataPathOut, FileOut, fNameSTA, cellFactor, DataConvertFactor, InterMth, correctNeg, &
DataPathOut, FileOut, fNameSTA, cellFactor, DataConvertFactor, OffSet, InterMth, correctNeg, &
distZero, author_name, projection_name, variable_name, variable_unit, variable_long_name, variable_standard_name, variable_calendar_type, &
yStart, mStart, dStart, yEnd, mEnd, dEnd,tBuffer, maxDist, flagVario, vType, nParam, &
fNameVario, dh, hMax, ncIn_variable_name, ncIn_dem_variable_name, ncIn_yCoord_name, ncIn_xCoord_name, invert_y, &
......@@ -467,9 +467,9 @@ contains
close (60)
nStaEfec = nStaEfec + 1
! unit conversion
if ( DataConvertFactor /= 1.0_dp ) then
where ( MetSta(i)%z(:) /= noDataValue ) MetSta(i)%z(:) = MetSta(i)%z(:) * DataConvertFactor
end if
!if ( DataConvertFactor /= 1.0_dp ) then
where ( MetSta(i)%z(:) /= noDataValue ) MetSta(i)%z(:) = MetSta(i)%z(:) * DataConvertFactor + OffSet
!end if
! check consistency
if (jDay /= jE ) then
print *, 'File ', trim(fileName), ' has missing values.', jE - jDay
......@@ -493,7 +493,7 @@ contains
use mo_kind, only: i4, dp
use mainVar, only: nSta, MetSta, grid, period, &
yStart, mStart, dStart, yEnd, mEnd, dEnd, jStart, jEnd
yStart, mStart, dStart, yEnd, mEnd, dEnd, jStart, jEnd, DataConvertFactor, OffSet
use kriging, only: maxDist
use VarFit, only: hmax
use runControl, only: interMth, DataPathIn
......@@ -611,7 +611,7 @@ contains
!
! add meteorological data
allocate(MetSta(iSta)%z(target_period%julStart:target_period%julEnd))
MetSta(iSta)%z = met_data(i, j, :)
MetSta(iSta)%z = met_data(i, j, :) * DataConvertFactor + OffSet
!
end do
end do
......
......@@ -27,6 +27,7 @@ module mainVar
integer(i4) :: cellFactor ! > 1 , size grid metereological data
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
! constants
......
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