Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Persefone.jl
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Persefone
Persefone.jl
Commits
c346859a
Commit
c346859a
authored
2 months ago
by
xo30xoqa
Browse files
Options
Downloads
Patches
Plain Diff
Updated weather.jl to new weather parameters
Now include cloud cover, humidity, and ETo, dropped vapourpressure
parent
a239757c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/world/weather.jl
+23
-9
23 additions, 9 deletions
src/world/weather.jl
with
23 additions
and
9 deletions
src/world/weather.jl
+
23
−
9
View file @
c346859a
...
...
@@ -13,10 +13,12 @@ struct Weather
windspeed
::
Union
{
Missing
,
Float64
}
precipitation
::
Union
{
Missing
,
Float64
}
sunshine
::
Union
{
Missing
,
Float64
}
vapourpressure
::
Union
{
Missing
,
Float64
}
cloudcover
::
Union
{
Missing
,
Float64
}
humidity
::
Union
{
Missing
,
Float64
}
meantemp
::
Union
{
Missing
,
Float64
}
maxtemp
::
Union
{
Missing
,
Float64
}
mintemp
::
Union
{
Missing
,
Float64
}
evapotranspiration
::
Union
{
Missing
,
Float64
}
end
"""
...
...
@@ -31,15 +33,15 @@ mapped to dates.
function
initweather
(
weatherfile
::
String
,
startdate
::
Date
,
enddate
::
Date
)
@debug
"Initialising weather"
data
=
CSV
.
File
(
weatherfile
,
missingstring
=
"NA"
,
dateformat
=
"yyyymmdd"
,
types
=
[
Date
,
Float64
,
Float64
,
Float64
,
Float64
,
types
=
[
Date
,
Float64
,
Float64
,
Float64
,
Float64
,
Float64
,
Float64
,
Float64
,
Float64
])
weather
=
Dict
{
Date
,
Weather
}()
for
row
in
data
if
row
.
date
>=
startdate
&&
row
.
date
<=
enddate
weather
[
row
.
date
]
=
Weather
(
row
.
mean_windspeed
,
row
.
precipitation
,
row
.
sunshine_hours
,
row
.
mean_
vapour_pressure
,
row
.
mean_
temperature
,
row
.
m
ax
_temperature
,
row
.
min_temperature
)
row
.
sunshine_hours
,
row
.
mean_
cloud_cover
,
row
.
mean_
humidity
,
row
.
m
ean
_temperature
,
row
.
max_temperature
,
row
.
min_temperature
)
end
end
if
length
(
weather
)
<=
Dates
.
value
(
enddate
-
startdate
)
...
...
@@ -76,12 +78,12 @@ function sunshine(model::SimulationModel)
end
"""
vapourpressure
(model)
humidity
(model)
Return today's average vapour pressure in
hPa
.
Return today's average vapour pressure in
%
.
"""
function
vapourpressure
(
model
::
SimulationModel
)
model
.
weather
[
model
.
date
]
.
vapourpressure
function
humidity
(
model
::
SimulationModel
)
model
.
weather
[
model
.
date
]
.
humidity
end
"""
...
...
@@ -110,3 +112,15 @@ Return today's minimum temperature in °C.
function
mintemp
(
model
::
SimulationModel
)
model
.
weather
[
model
.
date
]
.
mintemp
end
"""
evapotranspiration(model)
Return today's potential evapotranspiration (ETo), based on
the
"""
function
evapotranspiration
(
model
::
SimulationModel
)
model
.
weather
[
model
.
date
]
.
evapotranspiration
end
#TODO add functions for evapotranspiration
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment