-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from fabern/reduce-imports
Reduce imports of packages
- Loading branch information
Showing
7 changed files
with
18 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# [email protected], 2021-02-02 | ||
|
||
using CSV#: read, File | ||
using DataFrames#: rename, select | ||
using DataFramesMeta | ||
using CSV: read, File | ||
using DataFrames: DataFrame, rename# ,select | ||
using DataFramesMeta#: @linq, transform, DataFramesMeta | ||
using Dates: DateTime, Millisecond, Second, Day, month, value, dayofyear | ||
|
||
""" | ||
|
@@ -33,7 +33,7 @@ function read_LWFBrook90R_inputData(folder::String, prefix::String) | |
|
||
## B) Load input data (time- and/or space-varying parameters) | ||
# Load meteo | ||
input_meteo = @linq CSV.read(path_meteo, DataFrame; | ||
input_meteo = @linq read(path_meteo, DataFrame; | ||
datarow=2, delim=',', ignorerepeated=true, | ||
header=["dates", #"YY","MM","DD", | ||
"GLOBRAD","TMAX","TMIN","VAPPRES","WIND", | ||
|
@@ -54,17 +54,17 @@ function read_LWFBrook90R_inputData(folder::String, prefix::String) | |
|
||
input_meteo = @linq input_meteo |> | ||
transform(dates = DateTime2RelativeDaysFloat.(:dates, reference_date)) |> | ||
DataFrames.rename(Dict(:dates => :days)) | ||
rename(Dict(:dates => :days)) | ||
|
||
## C) Load other parameters | ||
# Load model input parameters | ||
#' @param param A numeric vector of model input parameters. Order (derived from param_to_rlwfbrook90()): | ||
input_param = DataFrame(CSV.File(path_param; types=[Float64, String], strict=true)) | ||
input_param = DataFrame(File(path_param; types=[Float64, String], strict=true)) | ||
|
||
# Load site parameters | ||
#' @param siteparam A [1,6] matrix with site level information: | ||
#' start year, start doy, latitude, initial condition snow, initial condition groundwater, precipitation interval. | ||
input_siteparam = DataFrame(CSV.File(path_siteparam; | ||
input_siteparam = DataFrame(File(path_siteparam; | ||
types=[Int64, Int64, Float64, Float64, Float64, Int64], strict=true, | ||
datarow=2, header=["start_year","start_doy","lat","SNOW_init","GWAT_init","precip_interval"], | ||
delim=',')) # ignorerepeated=true | ||
|
@@ -75,13 +75,13 @@ function read_LWFBrook90R_inputData(folder::String, prefix::String) | |
# TODO(bernhard): currently not implemented. | ||
# Only using PRECIN (resolution daily). | ||
# PRECDAT would allow to have smaller resolution (would require changes). | ||
# unused: input_precdat = CSV.read(path_precdat, DataFrame; | ||
# unused: input_precdat = read(path_precdat, DataFrame; | ||
# unused: missingstring = "-999", | ||
# unused: datarow=2, header=["year","month","day","interval_number","prec","mesflp"], delim=',', | ||
# unused: ignorerepeated=true) | ||
|
||
#' @param pdur a [1,12]-matrix of precipitation durations (hours) for each month. | ||
input_pdur = DataFrame(CSV.File(path_pdur; | ||
input_pdur = DataFrame(File(path_pdur; | ||
types=[Int64], strict=true, | ||
datarow=2, header=["pdur_h"], delim=',')) # ignorerepeated=true | ||
|
||
|
@@ -92,14 +92,14 @@ function read_LWFBrook90R_inputData(folder::String, prefix::String) | |
#' mat, ths, thr, alpha (m-1), npar, ksat (mm d-1), tort (-), stonef (-). | ||
#' When imodel = 2 (Clapp-Hornberger): | ||
#' mat, thsat, thetaf, psif (kPa), bexp, kf (mm d-1), wetinf (-), stonef (-). | ||
input_soil_materials = DataFrame(CSV.File(path_soil_materials; | ||
input_soil_materials = DataFrame(File(path_soil_materials; | ||
types=[Int64, Float64, Float64, Float64, Float64, Float64, Float64, Float64], | ||
datarow=2, header=["mat","ths","thr","alpha","npar","ksat","tort","gravel"], | ||
delim=','))# ignorerepeated=true | ||
|
||
#' @param soil_nodes A matrix of the soil model layers with columns | ||
#' nl (layer number), layer midpoint (m), thickness (mm), mat, psiini (kPa), rootden (-). | ||
input_soil_nodes = DataFrame(CSV.File(path_soil_nodes; | ||
input_soil_nodes = DataFrame(File(path_soil_nodes; | ||
types=[Int64,Float64, Float64, Int64, Float64, Float64], | ||
datarow=2, header=["layer","midpoint","thick","mat","psiini","rootden"], | ||
delim=','))# ignorerepeated=true | ||
|
@@ -149,5 +149,5 @@ end | |
# # Compute time relative to reference date | ||
# transform(dates = DateTime2RelativeDaysFloat.(:dates, reference)) |> | ||
# # Rename colum | ||
# DataFrames.rename(Dict(:dates => :days)) | ||
# rename(Dict(:dates => :days)) | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# [email protected], 2021-02-01 | ||
|
||
using LWFBrook90 | ||
using Test | ||
using Test: @test, @testset | ||
|
||
# @testset "Module WAT" begin | ||
@testset "KKMEAN" begin | ||
|