Skip to content

Commit

Permalink
Fix CO2 default for CZ
Browse files Browse the repository at this point in the history
  • Loading branch information
sannyschulz committed Aug 8, 2022
1 parent 723d0ef commit 42df85c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion hermes/dung.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func PrognoseTime(ZEIT int, g *GlobalVarsMain, herPath *HFilePath, driConfig *co
// overwrite weather data with prognosed weather data (optional? if not given no)
VWDAT := herPath.vwdatnrm
year, _, _ := KalenderDate(ZEIT)
s := NewWeatherDataShared(1)
s := NewWeatherDataShared(1, g.CO2KONZ)
err := WetterK(VWDAT, year, g, &s, herPath, driConfig)
if err != nil {
if g.DEBUGCHANNEL != nil {
Expand Down
6 changes: 3 additions & 3 deletions hermes/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func Run(workingDir string, args []string, logID string, out, logout chan<- stri
if driConfig.WeatherFileFormat == 1 {
yearEnde, _, _ := KalenderDate(g.ENDE)
years := yearEnde - g.ANJAHR + 1
bbbShared = NewWeatherDataShared(years)
bbbShared = NewWeatherDataShared(years, g.CO2KONZ)
err = ReadWeatherCSV(VWDATstr, g.ANJAHR, &g, &bbbShared, &herPath, &driConfig)
if err != nil {
return err
Expand All @@ -216,13 +216,13 @@ func Run(workingDir string, args []string, logID string, out, logout chan<- stri
herPath.vwdatTemplate = path.Join(driConfig.WeatherRootFolder, driConfig.WeatherFolder, driConfig.WeatherFile)
herPath.SetVwdatNoExt(g.FCODE)
VWDAT := herPath.VWdat(g.J)
bbbShared = NewWeatherDataShared(1)
bbbShared = NewWeatherDataShared(1, g.CO2KONZ)
WetterK(VWDAT, 1900+g.J, &g, &bbbShared, &herPath, &driConfig)
LoadYear(&g, &bbbShared, 1900+g.J)
} else if driConfig.WeatherFileFormat == 2 {
yearEnde, _, _ := KalenderDate(g.ENDE)
years := yearEnde - g.ANJAHR + 1
bbbShared = NewWeatherDataShared(years)
bbbShared = NewWeatherDataShared(years, g.CO2KONZ)
err = ReadWeatherCZ(VWDATstr, g.ANJAHR, &g, &bbbShared, &herPath, &driConfig)
if err != nil {
return err
Expand Down
9 changes: 3 additions & 6 deletions hermes/weather_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ import (
// altitude m (optional)
// CO2 concentration ppm (optional)

// BaseCO2 default co2 value (in 2000)
const BaseCO2 = 360.0

// WeatherDataShared all weather split in years
type WeatherDataShared struct {
JAR []int
Expand Down Expand Up @@ -55,7 +52,7 @@ type WeatherDataShared struct {
}

// NewWeatherDataShared returns a new WeatherDataShared struct
func NewWeatherDataShared(years int) WeatherDataShared {
func NewWeatherDataShared(years int, baseCO2 float64) WeatherDataShared {

s := WeatherDataShared{
JAR: make([]int, years),
Expand All @@ -80,7 +77,7 @@ func NewWeatherDataShared(years int) WeatherDataShared {
hasSUND: false,
hasETNULL: false,
}
s.fillCO2Value(BaseCO2)
s.fillCO2Value(baseCO2)
return s
}

Expand Down Expand Up @@ -475,7 +472,7 @@ func ReadWeatherCZ(VWDAT string, startyear int, g *GlobalVarsMain, s *WeatherDat
T := 0
yrz := 0
first := true
currentCO2 := BaseCO2
currentCO2 := s.CO2KONZ[0] // baseCO2 for first year
for scanner.Scan() {
line := scanner.Text()
T++
Expand Down
2 changes: 1 addition & 1 deletion src/climatefileconverter/monica_to_cz.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func ConvertFileMonicaToCZ(in, out string) error {

var g hermes.GlobalVarsMain
s := hermes.NewWeatherDataShared(36)
s := hermes.NewWeatherDataShared(36, 360)
var hPath hermes.HFilePath
driConfig := hermes.NewDefaultConfig()
driConfig.WeatherNoneValue = -99
Expand Down

0 comments on commit 42df85c

Please sign in to comment.