Commit e9115a6b authored by Dan Baston's avatar Dan Baston

Merge branch 'gldas' into 'master'

Gldas

See merge request !19
parents eb2d9a2e 33886d15
Pipeline #71502374 failed with stages
in 25 minutes and 36 seconds
......@@ -37,6 +37,11 @@ WORKDIR /wsim/wsim.agriculture
RUN sed -i 's/Version:.*/Version: '"$WSIM_VERSION"'/' DESCRIPTION
RUN make install
COPY wsim.gldas /wsim/wsim.gldas
WORKDIR /wsim/wsim.gldas
RUN sed -i 's/Version:.*/Version: '"$WSIM_VERSION"'/' DESCRIPTION
RUN make install
COPY workflow /wsim/workflow
WORKDIR /wsim/workflow
RUN sed -i 's/__version__.*/__version__ = "'"$WSIM_VERSION"'"/' wsim_workflow/version.py
......
install:
for s in wsim.io wsim.distributions wsim.lsm wsim.electricity wsim.agriculture; do \
for s in wsim.io wsim.distributions wsim.lsm wsim.electricity wsim.agriculture wsim.gldas; do \
$(MAKE) -C $${s} [email protected] || exit 1; \
done;
check:
for s in wsim.io wsim.distributions wsim.lsm wsim.electricity wsim.agriculture workflow; do \
for s in wsim.io wsim.distributions wsim.lsm wsim.electricity wsim.agriculture workflow wsim.gldas; do \
$(MAKE) -C $${s} [email protected] || exit 1; \
done;
Rscript test_cli.R
html:
for s in wsim.io wsim.distributions wsim.electricity wsim.agriculture wsim.lsm; do \
for s in wsim.io wsim.distributions wsim.electricity wsim.agriculture wsim.lsm wsim.gldas; do \
$(MAKE) -C $${s} [email protected] || exit 1; \
done;
$(MAKE) -C docs images html;
......@@ -17,19 +17,19 @@ publish-docs:
docs/_publish.sh
build-ci:
docker build -t isciences/wsim-gitlabci:latest - < Dockerfile.gitlabci
docker build --pull -t isciences/wsim-gitlabci:latest - < Dockerfile.gitlabci
push-ci:
docker push isciences/wsim-gitlabci:latest
build-dev:
docker build --build-arg WSIM_VERSION=0.0 -t isciences/wsim:dev .
docker build --pull --build-arg WSIM_VERSION=0.0 -t isciences/wsim:dev .
push-dev:
docker push isciences/wsim:dev
build:
docker build -t isciences/wsim:latest .
docker build --pull -t isciences/wsim:latest .
push:
docker push isciences/wsim:latest
......
@article{Beaudoing:2015,
title = {{GLDAS} Noah Land Surface Model L4 monthly 0.25 x 0.25 degree V2.0},
url = {https://disc.gsfc.nasa.gov/datasets/GLDAS_NOAH025_M_V2.0/summary?keywords=GLDAS},
doi = {10.5067/9SQ1B3ZXP2C5},
journaltitle = {Greenbelt, Maryland, {USA}, Goddard Earth Sciences Data and Information Services Center ({GES} {DISC})},
author = {Beaudoing, Hiroko and Rodell, M.},
urldate = {2019-04-23},
date = {2015},
note = {type: dataset
bibtex: Beaudoing:2015},
file = {GES DISC:U\:\\Documents\\Zotero\\storage\\TGB6DA9Q\\summary.html:text/html}
}
@article{Rodell:2004,
title = {The Global Land Data Assimilation System},
doi = {10.1175/BAMS-85-3-381},
abstract = {A Global Land Data Assimilation System ({GLDAS}) has been developed. Its purpose is to ingest satellite- and ground-based observational data products, using advanced land surface modeling and data assimilation techniques, in order to generate optimal fields of land surface states and fluxes. {GLDAS} is unique in that it is an uncoupled land surface modeling system that drives multiple models, integrates a huge quantity of observation-based data, runs globally at high resolution (0.25°), and produces results in near–real time (typically within 48 h of the present). {GLDAS} is also a test bed for innovative modeling and assimilation capabilities. A vegetation-based “tiling” approach is used to simulate subgrid-scale variability, with a 1-km global vegetation dataset as its basis. Soil and elevation parameters are based on high-resolution global datasets. Observation-based precipitation and downward radiation and output fields from the best available global coupled atmospheric data assimilation systems are employed as forcing data. The high-quality, global land surface fields provided by {GLDAS} will be used to initialize weather and climate prediction models and will promote various hydrometeorological studies and applications. The ongoing {GLDAS} archive (started in 2001) of modeled and observed, global, surface meteorological data, parameter maps, and output is publicly available.},
pages = {381--394},
number = {85},
journaltitle = {Bulletin of the American Meteorological Society},
shortjournal = {Bull. Amer. Meteor. Soc.},
author = {Rodell, M. and Houser, P.R. and Jambor, U. and Gottschalck, J. and Mitchell, K. and Meng, C. and Arsenault, K. and Cosgrove, B. and Radakovich, J. and Bosilovich, M. and Entin, J. K. and Walker, J. P. and Lohmann, D. and Toll, D.},
date = {2004},
note = {bibtex: Rodell:2004}
}
@online{WSIMdocs:2019,
title = {{WSIM}: Water security indicator model},
url = {https://wsim.isciences.com/index.html},
author = {{ISciences}},
urldate = {2019-05-31},
date = {2019},
note = {bibtex: {WSIMdocs}:2019},
file = {WSIM - Water Security Indicator Model — WSIM<br/>Water Security Indicator Model 2.0.890 documentation:U\:\\Documents\\Zotero\\storage\\K7WPM3RS\\index.html:text/html}
}
@article{Boogert:2005,
author = {Boogert, Alexander and Dupont, Dominique},
doi = {10.1016/j.econlet.2004.12.029},
......@@ -50,14 +88,14 @@
title={Global, Composite Runoff Fields Based on Observed River Discharge and Simulated Water Balances},
journal={},
url={http://www.grdc.sr.unh.edu/html/paper/ },
year=2010
year= {2010}
}
@Article{Hamon:1961,
author={W.R. Hamon},
title={Estimating potential evapotranspiration},
journal={Journal of the Hydraulics Division, Proceedings of the American Society of Civil Engineers},
year=1961,
year= {1961},
volume=87,
pages={107-120}
}
......@@ -67,7 +105,7 @@
title={Computation of direct runoff amounts from storm rainfall},
booktitle={Symposium Surface Waters},
editor={International Association of Hydrological Sciences},
year=1963,
year={1963},
number=63,
pages={52-62}
}
......@@ -75,7 +113,7 @@
@Book{Hosking:1997,
author={J.R.M. Hosking and J.R. Wallis},
title={Regional frequency analysis: an approach based on L-moments},
year=1997,
year={1997},
publisher={Cambridge University Press},
address={Cambridge, U.K.}
}
......@@ -94,7 +132,7 @@
journal={Journal of Climate},
volume=9,
pages={1350-1362},
year=1996,
year={1996},
url={http://www.cpc.noaa.gov/products/Soilmst_Monitoring/Papers/jhuang.pdf}
}
......@@ -149,7 +187,7 @@ year = {2011}
author={Jianbiao Lu and Ge Sun and Steven G. McNulty and Devendra Amatya},
title={A comparison of six potential evapotranspiration methods for regional use in the Southeastern United States},
journal={Journal of American Water Resources Association},
year=2005,
year={2005},
volume=41,
number=3,
pages={621-633},
......
#!/usr/bin/env Rscript
'
Process GLDAS NOAH monthly land surface model results to input to WSIM.
Usage: gldas_noah_extract (--input=<file>) (--output=<file>)
--input <file> GLDAS NOAH source file (netCDF)
--output <file> Output netCDF file with WSIM-friendly parameters
' -> usage
# GLDAS 2.0 NOAH parameters
# *** Note that kg/m2 of water is equivalent to mm of water ***
# # kg 1000g cm^3 m^2 10mm
# # ----- X ---------- X ----- X ------------ X ------ = mm
# # m^2 kg g 10000 cm^2 1cm
convert_w_msquared2mm_d <- function(watts_per_m2){
# converts from W m-2 to mm day-1
#
# W J kg m^3 1000 mm 86400 sec mm
# --- X ------ X ---------- X --------- X -------- X ----------- = ----
# m^2 W sec 2.5*10^6 J 1000 kg 1m day day
# (FAO, 1998. Crop evapotranpiration - Guidelines for computing crop water
# requirements -- FAO Irrigation and drainage paper 56. Table 1.
# http://www.fao.org/3/x0490e/x0490e04.htm#chapter%201%20%20%20introduction%20to%20evapotranspiration )
#
# And LDAS FAQs: https://ldas.gsfc.nasa.gov/faq/ldas
mm_per_day <- watts_per_m2 / (2.5e6) * 86400
return(mm_per_day)
}
converth2o_kg_msquared_s2mm_day <- function(kg_per_m2_per_s){
# Converts from kg water m-2 sec-1 to mm day-1
#
# kg 1000g m^2 cm^3 10 mm
# ---- X ------ X ---------- X ---------- X --------
# m^2 kg 10000 cm^2 g cm 86400 sec
# ____________________________________________________ X ___________
# sec day
#
mm_per_day <- kg_per_m2_per_s * 86400
return(mm_per_day)
}
converth20_kg_msquared_3hour2mm_day <- function(kg_per_m2_per_3hr){
# Converts from kg water m-2 (3hour)-1 to mm day-1
#
# kg 1000g m^2 cm^3 10 mm
# ---- X ------ X ---------- X ---------- X --------
# m^2 kg 10000 cm^2 g cm 8 3hr
# ____________________________________________________ X __________
# 3hr day
#
mm_per_day <- kg_per_m2_per_3hr * 8
return(mm_per_day)
}
main <- function(raw_args){
args <- wsim.io::parse_args(usage=usage, args=raw_args)
fname <- args$input
outfile <- args$output
if (!wsim.io::can_write(outfile)) {
wsim.io::die_with_message("Cannot open", outfile, "for writing.")
}
monthdays <- wsim.gldas::get_ndays_from_fname(fname)
gldas_list <- wsim.io::read_vars_from_cdf(fname)
# Create new raster layers using arithmetic on the raster brick
T <- gldas_list$data$Tair_f_inst - 273.15
Pr <- converth2o_kg_msquared_s2mm_day(gldas_list$data$Rainf_f_tavg)*monthdays
# "Evap" is equivalent to evapotranspiration, and
# "PotEvap" is equivalent to PET, as described in the
# Land Information System (LIS) Users' Guide 7.2 (May 2017)
# https://modelingguru.nasa.gov/servlet/JiveServlet/previewBody/2634-102-1-6531/LIS_usersguide.pdf
potevaptr <- convert_w_msquared2mm_d(gldas_list$data$PotEvap_tavg)*monthdays
actevaptr <- converth2o_kg_msquared_s2mm_day(gldas_list$data$Evap_tavg)*monthdays
PETmE <- potevaptr - actevaptr
RO_mm <- converth20_kg_msquared_3hour2mm_day(gldas_list$data$Qs_acc)*monthdays +
converth20_kg_msquared_3hour2mm_day(gldas_list$data$Qsb_acc)*monthdays +
converth20_kg_msquared_3hour2mm_day(gldas_list$data$Qsm_acc)*monthdays
# Soil moisture is in kg m-2, which == mm for water
#Ws <- (0.1*gldas_list$data$SoilMoi0_10cm_inst+0.3*gldas_list$data$SoilMoi10_40cm_inst+0.6*gldas_list$data$SoilMoi40_100cm_inst)
Ws <- (gldas_list$data$SoilMoi0_10cm_inst + gldas_list$data$SoilMoi10_40cm_inst + gldas_list$data$SoilMoi40_100cm_inst)
# Create list of matrices and write to netCDF
gldas_newmats <- list(T=T, Pr=Pr, PETmE=PETmE, RO_mm=RO_mm, Ws=Ws)
# Write to file
wsim.io::write_vars_to_cdf(vars=gldas_newmats, filename=outfile, extent=gldas_list$extent)
}
tryCatch(main(commandArgs(TRUE)), error=wsim.io::die_with_message)
#!/usr/bin/env bash
# Copyright (c) 2018 ISciences, LLC.
# All rights reserved.
#
# WSIM is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
display_usage() {
echo "Convert a CFS forecast from GRIB2 (Gaussian grid) to netCDF (0.5-degree grid)"
echo "gldas_noah_extract.sh [in] [out]"
}
if [ $# -le 1 ]
then
display_usage
exit 1
fi
TMP=`mktemp --suffix ".nc"`
ncap2 -O -v -s "PETmE=(PotEvap_tavg-Evap_tavg);Ws=(0.1*SoilMoi0_10cm_inst+0.3*SoilMoi10_40cm_inst+0.6*SoilMoi40_100cm_inst);RO_mm=Qs_acc+Qsb_acc+Qsm_acc" $1 $TMP
ncpdq -O -a -lat $TMP $TMP # Flip latitudes to get North -> South ordering
ncatted -h -O \
-a long_name,PETmE,o,c,'Potential minus Actual Evapotranspiration' \
-a vmin,PETmE,d,, \
-a vmax,PETmE,d,, \
-a long_name,Ws,o,c,'Average Soil Moisture' \
-a standard_name,Ws,o,c,'soil_moisture_content' \
-a vmin,Ws,d,, \
-a vmax,Ws,d,, \
-a long_name,RO_mm,o,c,'Runoff' \
-a standard_name,RO_mm,o,c,'surface_runoff_amount' \
-a vmin,RO_mm,d,, \
-a vmax,RO_mm,d,, $TMP
# Drop the time dimension
ncwa -h -O -a time $TMP $TMP
# Drop the time variable
ncks -h -C -O -x -v time $TMP $TMP
# Add a CRS variable
ncap -h -O -s 'crs=-9999' $TMP $TMP
ncatted -h -O \
-a spatial_ref,crs,c,c,'GEOGCS[\"GCS_WGS_1984\",DATUM[\"WGS_1984\",SPHEROID[\"WGS_84\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.017453292519943295]]' \
-a grid_mapping_name,crs,c,c,'latitude_longitude' \
-a longitude_of_prime_meridian,crs,c,d,0 \
-a semi_major_axis,crs,c,d,6378137 \
-a inverse_flattening,crs,c,d,298.257223563 \
-a grid_mapping,PETmE,c,c,'crs' \
-a grid_mapping,Ws,c,c,'crs' \
-a grid_mapping,RO_mm,c,c,'crs' \
$TMP
mv $TMP $2
......@@ -83,7 +83,7 @@ seek_to_month <- function(fh, init_yearmon, yearmon, nx, ny) {
#' @param nx number of columns in each grid
#' @param ny number of rows in each grid
get_last_month <- function(filename, init_yearmon, nx, ny) {
n_months <- file.size(filename) / grid_size_with_padding(nx, ny)
n_months <- floor(file.size(filename) / grid_size_with_padding(nx, ny))
year <- as.integer(substr(init_yearmon, 1, 4))
month <- as.integer(substr(init_yearmon, 5, 6)) + (n_months - 1)
......
......@@ -449,7 +449,7 @@ class CFSConfig(ConfigBase):
def static_data(self):
return self._static
def workspace(self):
def workspace(self) -> paths.DefaultWorkspace:
return self._workspace
......
# Copyright (c) 2018 ISciences, LLC.
# Copyright (c) 2018-2019 ISciences, LLC.
# All rights reserved.
#
# WSIM is licensed under the Apache License, Version 2.0 (the "License").
......@@ -13,7 +13,6 @@
from wsim_workflow.step import Step
from wsim_workflow import paths
from wsim_workflow import dates
from wsim_workflow.config_base import ConfigBase
from wsim_workflow.data_sources import ntsg_drt, hydrobasins
......@@ -60,6 +59,7 @@ class GLDAS20_NoahStatic(paths.Static):
def basin_downstream(self):
return paths.Vardef(os.path.join(self.source, 'HydroBASINS', 'basins_lev05_downstream.nc'), 'next_down')
class GLDAS20_NoahConfig(ConfigBase):
def __init__(self, source, derived):
......@@ -80,7 +80,7 @@ class GLDAS20_NoahConfig(ConfigBase):
return range(1948, 2011)
def result_fit_years(self):
return range(1950, 2010) # 1950-2009 gives even 60-year period
return range(1950, 2010) # 1950-2009 gives even 60-year period
def static_data(self):
return self._static
......@@ -93,7 +93,7 @@ class GLDAS20_NoahConfig(ConfigBase):
@staticmethod
def integration_windows():
return [ 12 ]
return [3, 6, 12]
@classmethod
def forcing_rp_vars(cls, basis=None):
......@@ -106,7 +106,9 @@ class GLDAS20_NoahConfig(ConfigBase):
'Bt_RO',
'PETmE',
'RO_mm',
'Ws'
'Ws',
'T',
'Pr'
]
if basis == 'basin':
......@@ -120,25 +122,23 @@ class GLDAS20_NoahConfig(ConfigBase):
def lsm_integrated_vars(cls, basis=None):
if not basis:
return {
'Bt_RO' : [ 'min', 'max', 'sum' ],
'PETmE' : [ 'sum' ],
'RO_mm' : [ 'sum' ],
'Ws' : [ 'ave' ]
'Bt_RO': ['min', 'max', 'sum'],
'PETmE': ['sum'],
'RO_mm': ['sum'],
'Ws' : ['ave'],
'T' : ['ave'],
'Pr' : ['sum']
}
if basis == 'basin':
return {
'Bt_RO_m3' : [ 'sum' ]
'Bt_RO_m3' : ['sum']
}
assert False
def result_postprocess_steps(self, yearmon=None, target=None, member=None):
year, mon = dates.parse_yearmon(yearmon)
input_file = os.path.join(self._source,
'GLDAS20',
'{:04d}'.format(year),
'GLDAS_NOAH025_M.A{}.020.nc4'.format(yearmon))
output_file = self.workspace().results(yearmon=yearmon, window=1)
......@@ -149,9 +149,9 @@ class GLDAS20_NoahConfig(ConfigBase):
dependencies=[input_file, self.static_data().flowdir().file],
commands=[
[
os.path.join('{BINDIR}', 'utils', 'gldas_noah_extract.sh'),
input_file,
output_file
os.path.join('{BINDIR}', 'utils', 'gldas_noah_extract.R'),
'--input', input_file,
'--output', output_file
],
[
os.path.join('{BINDIR}', 'wsim_flow.R'),
......@@ -165,4 +165,5 @@ class GLDAS20_NoahConfig(ConfigBase):
)
]
config = GLDAS20_NoahConfig
This diff is collapsed.
......@@ -51,6 +51,12 @@ def parse_args(args):
parser.add_argument('--nospinup',
help='Skip model spin-up steps',
action='store_true')
parser.add_argument('--noelectric',
help='Do not write steps for electric power assessment',
action='store_true')
parser.add_argument('--noagriculture',
help='Do not write steps for agriculture assessment',
action='store_true')
parser.add_argument('--module',
help="Name of output module",
default='gnu_make')
......@@ -94,8 +100,8 @@ def main(raw_args):
stop=args.stop,
no_spinup=args.nospinup,
forecasts=args.forecasts,
run_electric_power=True,
run_agriculture=True)
run_electric_power=not args.noelectric,
run_agriculture=not args.noagriculture)
duplicate_targets = workflow.find_duplicate_targets(steps)
if duplicate_targets:
......
......@@ -365,7 +365,7 @@ def fit_var(config: ConfigBase,
else:
param_to_read = param
if param in ('T', 'Pr'):
if param in config.forcing_rp_vars():
assert window == 1
assert basis is None
......@@ -373,6 +373,7 @@ def fit_var(config: ConfigBase,
else:
infile = config.workspace().results(yearmon=input_range, window=window, basis=basis)
# Step for fits
return [
wsim_fit(
......
......@@ -165,6 +165,7 @@ class ConfigBase(metaclass=abc.ABCMeta):
assert False
@classmethod
def lsm_integrated_vars(cls, basis: Optional[Basis]=None) -> Dict[str, List[str]]:
"""
......@@ -211,3 +212,5 @@ class ConfigBase(metaclass=abc.ABCMeta):
Provides a flat list of time-integrated variable names
"""
return [var + '_' + stat for var, stats in cls.lsm_integrated_vars(basis=basis).items() for stat in stats]
......@@ -56,41 +56,40 @@ def monthly_observed(config: Config, yearmon: str, meta_steps: Dict[str, Step])
steps += time_integrate(config.workspace(), config.lsm_integrated_stats(), yearmon=yearmon, window=window)
# Compute return periods
steps += compute_return_periods(config.workspace(),
result_vars=config.lsm_rp_vars(),
forcing_vars=config.forcing_rp_vars(),
yearmon=yearmon,
window=1)
for window in config.integration_windows():
for window in [1] + config.integration_windows():
steps += compute_return_periods(config.workspace(),
result_vars=config.lsm_integrated_var_names(),
result_vars=config.lsm_rp_vars() if window==1 else config.lsm_integrated_var_names(),
forcing_vars=config.forcing_rp_vars() if window==1 else None,
yearmon=yearmon,
window=window)
# Compute composite indicators
for window in [1] + config.integration_windows():
composite_indicator_steps = composite_indicators(config.workspace(), window=window, yearmon=yearmon)
steps += composite_indicator_steps
meta_steps['all_composites'].require(composite_indicator_steps)
if window == 1:
meta_steps['all_monthly_composites'].require(composite_indicator_steps)
# Don't write composite steps for a window that extends back too early.
if yearmon > config.historical_yearmons()[window-1]:
composite_indicator_steps = composite_indicators(config.workspace(), window=window, yearmon=yearmon)
steps += composite_indicator_steps
meta_steps['all_composites'].require(composite_indicator_steps)
if window == 1:
meta_steps['all_monthly_composites'].require(composite_indicator_steps)
if yearmon not in config.historical_yearmons():
steps += composite_anomalies(config.workspace(), window=window, yearmon=yearmon)
if yearmon not in config.historical_yearmons():
steps += composite_anomalies(config.workspace(), window=window, yearmon=yearmon)
# Express composite anomalies in terms of a return period
# (relative to historical composite anomalies)
steps += composite_indicator_return_periods(config.workspace(), yearmon=yearmon, window=window)
# Express composite anomalies in terms of a return period
# (relative to historical composite anomalies)
steps += composite_indicator_return_periods(config.workspace(), yearmon=yearmon, window=window)
# Produce an "adjusted" composite based on the return periods
# of the composite surface anomaly and composite deficit anomaly
adjusted_indicator_steps = composite_indicator_adjusted(config.workspace(), yearmon=yearmon, window=window)
steps += adjusted_indicator_steps
# Produce an "adjusted" composite based on the return periods
# of the composite surface anomaly and composite deficit anomaly
adjusted_indicator_steps = composite_indicator_adjusted(config.workspace(), yearmon=yearmon, window=window)
steps += adjusted_indicator_steps
meta_steps['all_adjusted_composites'].require(adjusted_indicator_steps)
if window == 1:
meta_steps['all_adjusted_monthly_composites'].require(adjusted_indicator_steps)
meta_steps['all_adjusted_composites'].require(adjusted_indicator_steps)
if window == 1:
meta_steps['all_adjusted_monthly_composites'].require(adjusted_indicator_steps)
return steps
......@@ -127,12 +126,14 @@ def monthly_forecast(config: Config, yearmon: str, meta_steps: Dict[str, Step])
member=member)
# Compute return periods
steps += compute_return_periods(config.workspace(), result_vars=config.lsm_rp_vars(),
forcing_vars=config.forcing_rp_vars(), yearmon=yearmon,
window=1, target=target, member=member)
for window in config.integration_windows():
steps += compute_return_periods(config.workspace(), result_vars=config.lsm_integrated_var_names(),
yearmon=yearmon, window=window, target=target, member=member)
for window in [1] + config.integration_windows():
steps += compute_return_periods(config.workspace(),
forcing_vars=config.forcing_rp_vars() if window==1 else None,
result_vars=config.lsm_rp_vars() if window==1 else config.lsm_integrated_var_names(),
yearmon=yearmon,
window=window,
target=target,
member=member)
steps += meta_steps['forcing_summaries'].require(forcing_summary(config.workspace(),
config.forecast_ensemble_members(yearmon),
......
......@@ -72,6 +72,7 @@ def spinup(config, meta_steps):
for param in config.lsm_integrated_vars().keys():
for stat in config.lsm_integrated_vars()[param]:
for window in config.integration_windows():
assert window > 1
for month in all_months:
steps += all_fits.require(fit_var(config, param=param, stat=stat, month=month, window=window))
......@@ -290,7 +291,7 @@ def run_lsm_from_mean_spinup_state(config: Config) -> List[Step]:
def time_integrate_results(config: Config, window: int, *, basis: Optional[Basis]=None) -> List[Step]:
"""
Integrate all LSM results with the given time window
Integrate all LSM results and any specified forcing variables with the given time window
"""
yearmons_in = config.historical_yearmons()
yearmons_out = yearmons_in[window-1:]
......
......@@ -57,7 +57,8 @@ class Step:
:param working_directories a string or list of strings indicating directories that should be
created, if not already present, before this step executes. Any directory
included in a target is implied and does not need to be specified.
:param commands: a list of
:param commands: a list of commands, where each command is represented as a list of tokens
:param comment: an optional text comment to be associated with the step
"""
......
......@@ -70,6 +70,7 @@ def generate_steps(config: ConfigBase, *,
if run_agriculture:
steps += agriculture.spinup(config, meta_steps)
for i, yearmon in enumerate(reversed(list(dates.get_yearmons(start, stop)))):
steps += monthly.monthly_observed(config, yearmon, meta_steps)
......
^.*\.Rproj$
^\.Rproj\.user$
Package: wsim.gldas
Type: Package
Title: Process GLDAS land surface model data for WSIM
Version: 0.1.0
[email protected]: person("Cynthia", "Crowley", email = "[email protected]", role = c('aut', 'cre'))
Description: The wsim.gldas package provides utilities to download and pre-process, and pass to WSIM the land surface model outputs from NASA's Global Land Data Assimilation System (GLDAS).
Imports:
wsim.io,
wsim.lsm
License: file LICENSE
Encoding: UTF-8
LazyData: true
Suggests:
testthat (>= 2.1.0)
This diff is collapsed.
NAMESPACE:
echo "# Generated by roxygen2: do not edit by hand" > NAMESPACE
.PHONY: clean
clean:
find ./ -name "*.so" | xargs rm
find ./ -name "*.o" | xargs rm
find ./ -name "RcppExports.*" | xargs rm
check: NAMESPACE
Rscript -e "results <- devtools::check(); stopifnot(length(results[['errors']]) == 0)"
install: NAMESPACE
Rscript -e "devtools::document(); devtools::install()"
html: NAMESPACE
Rscript -e "devtools::document(); pkgdown::build_site()"
exportPattern("^[[:alpha:]]+")