dataesr/scientific-paragraphs-categorization huggingface dataset:
Downscaling methods Downscaling is designed to increase the resolution of a dataset. In a climate service chain, downscaling is a fundamental step to transform the climate simulations from their coarse resolution to the finer resolution required by many final users studying regional environmental changes  (Maraun et al. , 2010; Rössler et al. , 2019). CSTools contains five different downscaling methodologies based on analog techniques, stochastic simulations, or regression. The CST_Analogs function can be used to downscale any gridded dataset using analogs. The function, based on the method of  Yiou et al. (2013) , searches for days, with similar large-scale conditions, to provide high-resolution fields over a specific region. Regions and variables can be defined by the user, and the following three different criteria to select the analogs are available: (1) minimum Euclidean distance in the large-scale pattern, (2) minimum Euclidean distance in a large-scale pattern and in a local-scale pattern, and (3) minimum Euclidean distance in a large-scale pattern and a local scale pattern and a maximum correlation in a local variable to be downscaled.
CST_RFTemp implements a simple lapse rate correction to a near-surface temperature field to account for changes in orography between a low-and high-resolution gridded dataset. ADAMONT (ADAptation of RCM outputs to MOuNTain regions;  Verfaillie et al. , 2017)  is a downscaling method designed to adjust forecasts of daily variables. The method is based on the quantile mapping approach and originally relied on a regional reanalysis of hourly meteorological conditions. In total, two functions to implement ADAMONT have been included in CSTools. CST_AdamontQQcor computes a quantile mapping based on weather types for forecast data, while CST_AdamontAnalog uses these weather types to find analogous data in the reference dataset. The CST_AnalogsPredictors function downscales precipitation or maximum/minimum temperature low-resolution forecast output data through the association with an observational high-resolution dataset  (Peral García et al.
Calibration can be considered as being a way of obtaining predictions with average statistical properties similar to those of a reference dataset. CST_Calibration performs the correction on the forecast systems' simulations using five different member-by-member methodologies, where each methodology can adjust one or more of the statistical properties of the predictions. The selection of the most appropriated method will thus depend on the user's needs. The "bias" method corrects the mean bias only, and the "evmos" method applies a variance inflation technique to ensure the correction of the mean and the correspondence of variance between forecasts and observations (Van Schaeybroeck and Vannitsem, 2011). The ensemble calibration methods "mse_min" and "crps_min" correct the bias, the overall forecast variance, and the ensemble spread as described in Doblas-Reyes et al.
CST_BiasCorrection performs the same analysis as CST_Calibration using the evmos method but allowing us to calibrate either a hindcast or forecast. CST_QuantileMapping performs a quantile mapping adjustment by matching the probability distribution of a forecast with the probability distribution of a set of observations. The function in CSTools calculates the relation between a set of past forecasts (i. e. , hindcasts) and observations and applies the correction to the hindcast itself or to a different forecast. This function relies on the R package qmap  (Gudmundsson et al. , 2012; Gudmundsson, 2016). The user can set several parameters to define the distance between quantiles when adjusting the distribution, or the sample length in cases when the user wants to split the temporal dimension to apply separate adjustments.
e. , CST_Load and CST_BiasCorrection. The key decisions are the parameters used to retrieve the data from files to achieve a coherent analysis of the March 2018 event (Fig. 7 ). The analysis is repeated for three different start dates (i. e. , December, January, and February). In all the data loading calls, the same region must be requested through the parameters lonmin, lonmax, latmin, and latmax of the function CST_Load. The output type requested to be gridded data rather than area average by setting output parameter as "lonlat". Note that the code could be adapted to other regions, time periods, and variables, and a detailed description of the code is provided below for users interested in modifying the necessary parameters. The name of the different variables required must be specified in the CST_Load call through the parameter var, and the function will read the corresponding variables written in the NetCDF files in the data storage.
Therefore, the var parameter is set to "sfcWind" when retrieving hindcasts and forecasts, while for the reference dataset it is set to "windagl100". Given the difference in spatial resolution, a regridding of the reference dataset is also requested via the grid parameter. The path patterns expressing the set of files that comprise the simulations and the reference datasets are also passed to the CST_Load function through parameters exp and obs, respectively. Note that the labels $STORE_FREQ$, $VAR_NAME$, $START_DATE$, $YEAR$, and $MONTH$ are used when defining the patterns. These labels will be interpreted and replaced by the function following the information provided in the other parameters of CST_Load. An index, mm, indicating the number of preceding months (mm) is introduced to loop over the three start dates in order to simplify the code.
When mm is 1, the bias adjustment for March with the forecasts initialized 1 month in advance (i. e. , the February start date) is computed. The target year is set in the year variable as 2018. The start dates of the simulations to be loaded are created and stored in the "hcst_sdates" and "fcst_sdates" variables, which correspond to a vector of dates for 1 February from 1993 to 2017 and 1 February 2018, respectively. For the February start date, the second lead time (i. e. , mm + 1) corresponds to the forecast for March, which is selected through the leadtimemin and leadtimemax parameters. Finally, a simple bias correction method (CST_BiasCorrection) is used to compute the biases between the hindcast and the reference datasets and then apply a correction to the mean and standard deviation of the forecast dataset.
The code of this use case could be reused to evaluate the seasonal forecast performance. The evaluation could consider whether other variables were better at capturing the situation in a specific event or if a different bias correction method would improve the skill of the seasonal forecast. Furhttps://doi. org/10. 5194/gmd-15-6115-2022 Geosci. Model Dev. , 15, 6115-6142, 2022 thermore, it is possible to easily modify this code to compare the results provided by different models.
The reference datasets employed are (i) ERA5 daily precipitation reanalysis at 0. 25 • (around 30 km) spatial resolution, for the bias correction and for the estimation of the spectral slopes employed in the downscaling procedure, and (ii) the WorldClim2 monthly climatology at 1 km spatial resolution  (Fick and Hijmans, 2017) , for generating the precipitation weights used to introduce the orographic effects in the downscaled fields. In this case, the region of study is the Alps mountain range in central Europe (42-49 • N, 4-11 • E), including the high-elevation stations for which the SNOWPACK model is run (although SEAS5 and ERA5 datasets are locally stored for the global domain). The RainFARM downscaling method incorporated within CSTools is employed to downscale precipitation which is then used as input for the SNOWPACK model.
Then, CST_Load retrieves the data from files and arranges it with the following dimensions: dataset of length 1, since only ERA5 is being requested, member = 1, since this reanalysis only provides one simulation, and the sdate dimension is of length 312, which corresponds to the 26 years of 12 months defined in object years with the ftime dimension up to 31, corresponding to each day of the month. The remaining dimensions, lat and lon correspond to the squared domain requested in CST_Load. Given that CST_Load splits the time series among sdates and ftime dimension when specifying a forecast dataset, our ERA5 path pattern has been requested through this option. On the other hand, specifying the ERA5 path pattern as an observational dataset (in the obs parameter), the function will return a continuous time series from 1993 to 2018, which is less convenient for our purposes here.
In this example over the Alpine domain, the slope of the spatial power spectrum of ERA5 daily precipitation at 0. 25 • exhibits temporal variability at the seasonal scale. In order to account for this, we calculate the spectral slopes at the monthly timescale, fitting wavenumbers 5 and higher (scales smaller than about 250 km) in order to better reproduce the slope of the spectrum at small scales (see  Terzago et al. , 2020, for details). The results of this code are the spectral slopes from January to December. In the second step, we load the data, taking advantage of library zeallot  (Teetor, 2018)  that allows us to simplify our code by using an advanced version of the assignment operator (% < -%). Again, the paths to the necessary data must be defined using labels; for the forecast data, the path points to the SEAS5 dataset, while for the reference data, the path points to the ERA5 reanalysis.
Thanks to CST_Load, these datasets can be interpolated onto a common grid, which, by default, is the grid of the first dataset provided, i. e. , the SEAS5 grid. The vector "StartDates", which defines the period of study for the 1 November simulations, is then assigned to the sdates parameter. In order to apply the quantile mapping correction month by month, the function CST_SplitDim is used to divide the forecast time dimension in two, with one for identifying the days of the month and another to store each month separately. Step 3 computes the orographic weights from a finescale precipitation climatology. In this case, the WorldClim2 dataset precipitation at 30 s resolution is used although other https://doi. org/10. 5194/gmd-15-6115-2022 Geosci. Model Dev. , 15, 6115-6142, 2022 climatologies from a high-resolution dataset could be used.
The WorldClim2 dataset is formatted in. tiff files that can be automatically downloaded in the R session thanks to the raster library  (Hijmans, 2020). The piece of code for Step 3 shows how to compute the orographic weights for all individual months at once, i. e. , obtaining the data from the remote dataset, subsetting for the Alps region with a small increment to correctly compute interpolation (3. 5-11. 5 • E, 41. 5-49. 5 • N), and storing the data in an s2dv_cube object to be passed to CST_RFWeights. The target resolution is the one most suitable for each specific application. To run the SNOWPACK model, we are interested in the local scale, and we choose a target resolution of 0. 01 • , corresponding to about 1 km. Therefore, the weights and the RainFARM method (step 4) would be computed with a refinement factor (nf) of 100.
However, such a high refinement factor implies a rather large computational load, and here we show the code using refinement factor 4. We recommend that the users to approximate the expected size of the final output, as follows: the original data input of the downscaling step has 25 members, 26 start dates, and 31 daily lead times in 8 months, covering a region of 8 by 8 grid points, which is 8 (bits/byte) times its product at ∼ 80 MB; this size will increase by a factor of 10, since the realizations and the refinement factor will be applied on both spatial di-mensions. For a refinement factor of 100 (4), the expected output is ∼ 80 MB × 10×100×100 (∼ 80 MB ×10×4×4), so around 8 TB (12. 5 GB). The users need to consider that the data size also has implications for the computation time. Finally, the downscaling method is run in step 4 using the corrected forecast, the slope, and the weights computed in the previous steps.
Note that this code requires high memory resources, although the computation can be split by start date and realization if necessary. Figure  11  shows an example of the results for a random day (11 December 1993) of each post-processing step and the final result for one of the realizations. The monthly spectral slopes obtained in step 1 (Fig. 11c ) show an annual cycle. The result of step 2 is a bias-corrected forecast consistent with the reference dataset in that the forecast probability density function matches the one for the references, resulting in the same climatology (Appendix C). A simple visual evaluation of the impact of the quantile mapping correction is available in Fig. 11a  and b. The results of step 3 (Fig. 11d  and f ) are the monthly spectral slopes for which values greater (lower) than 1 amplify (reduce) the precipitation signal from the seasonal forecast.
Use case 3: seasonal forecasts for a river flow In this last use case, we provide downscaled and biasadjusted seasonal forecasts of daily maximum, minimum, and mean temperature and precipitation. This use case can be relevant, for instance, to climate scientists, hydrologists, and developers of agriculture services because these variables are often used to calculate the evapotranspiration using the Hargreaves and Samani equation (e. g. ,  Oudin et al. , 2005). Indeed, while the typical seasonal forecasts are provided at a resolution of around 100 km, the spatial resolution required by some hydrological models is 5 km  (Roulin and Vannitsem, 2005). Rather than giving detailed code instructions similar to the previous use cases, an extensive discussion on the datageneration process is provided, and the code is made available online.
Note again that all steps are being executed using only CSTools functions. The domain in this case covers the Aliakmon basin and a large part of Greece. Apart from the variables aimed to postprocess, the sea level pressure (SLP) is used as a requirement for the downscaling method chosen. As seasonal forecast data, all the variables are taken for the 25 members of SEAS5 initialized on 1 May for the 1993-2019 period. For the reference rainfall dataset, the daily data from CHIRPS (Climate Hazards group Infrared Precipitation with Stations; https://data. chc. ucsb. edu/products/CHIRPS-2. 0/, last access: 24 July 2022;  Funk et al. , 2015)  are taken, and the available 0. 05 • resolution is used. Moreover, this dataset incorporates corrections for different mountain elevations and slopes, which is relevant in the orographically complex Aliakmon basin with elevations above 2000 m.
13 , the overall methodology can be separated into a bias adjustment phase (steps 1-2) and a downscaling phase (steps 3-5) that uses an analog approach. The bias adjustment phase starts by loading (using CST_Load) the daily forecast and observational rainfall data over Greece upscaled at 1 • resolution. In step 2, these daily rainfall forecasts are bias adjusted (using CST_Calibration with method bias) against the CHIRPS dataset. The bias adjustment is done per month of lead time using a leave-one-out or cross-validation approach. Breaking up the data per month was done using the CST_SplitDim function. The downscaling phase starts in step 3 (see Fig. 13 ) by loading the sea level pressure (SLP) of the forecast and reference at 1 • resolution over Europe. In step 4, both the biasadjusted precipitation fields of a particular forecast day over Greece and the SLP anomaly fields over Europe of a particular forecast day are selected.
These fields are then compared to all the fields of a large climatological reference dataset in order to find the best analog (using the Analogs function). This dataset covers the period 1993-2019 but includes only days with the same month as the selected day (and excludes the selected day). Separating the data per month was again done using the CST_SplitDim function. The criterion to find the best analog is called Local_dist and minimizes the Euclidean distances of the large-scale SLP and the local-scale rainfall patterns, both at 1 • resolution. Finally, for the day corresponding to the best analog, the CHIRPS precipitation field at 0. 05 • resolution is then selected as the bias-adjusted and downscaled field of the selected day (see Fig. 14c  and d ). In order to obtain the temperature, the ERA5-Land dataset over Greece is considered for the day of the best analog.
Conclusions CSTools contains state-of-the-art methods to post-process seasonal forecast datasets specially focusing on statistical correction and downscaling methods and classification methods. These methods are extremely valued in the community, given the need for correcting intrinsic systematic model errors and the need for many final applications to have these forecasts in higher resolution than the original resolution provided by the forecast systems. On the other hand, the visualization tools tailored for probabilistic forecasts are able to summarize the results in a concise, yet user-friendly, manner. The three use cases showcased the ability of the CSTools R package to comprehensively post-process seasonal forecasts in the context of scientifically advanced impact modeling. The final users potentially interested in these three use cases represent a classical current-day sample of the users (and disciplines) that can benefit from CSTools.
e. , the data loading feature allows users to easily load and arrange the forecast and the reference datasets in a common structure (i. e. , the s2dv_cube object), simplifying the subsequent data manipulation steps, and the internal use of the multiApply package in the data processing functions makes them flexible to work with any number of dimensions and allows parallel computation. Finally, its compatibility with the startR package allows us to process datasets larger than the available RAM memory. The development guidelines are a fundamental piece of documentation for the future extension of the package when new state-of-the-art methods are required or become available. These guidelines are already being adopted by another R package called CSIndicators (that stands for Climate Services Indicators), which is dedicated to calculating the most suitable tailored indicator for each particular climate service application (agriculture, food security, energy, water management.
). Other types of documentation, such as vignettes, provided along with the package, are intended to facilitate the users' learning process. Appendix A: Details on data collection, curation, homogenization, and requirements for CST_Load In order to use CST_Load, the storage needs to be homogenized. CST_Load accepts several parameters to configure the loading and interpolation of data. The CST_Load documentation in the reference manual is linked to the s2dverification  (Manubens et al. , 2018)  reference manual where the description of all parameters is detailed. Basically, CST_Load requires path patterns pointing to the NetCDF files or OPeNDAP URLs requested via the other parameters. A variable with a matching name must be present in the files. The path patterns, one for each experimental/observational dataset to be loaded, express the set of files comprising each dataset.
Therefore, a path pattern is a string containing some specific wildcards that are recognized and replaced by the corresponding values by CST_Load. The most commonly used wildcards in a path pattern spec-ification are "$START_DATE$", "$STORE_FREQ$", and "$VAR_NAME$". For example, when given a dataset that consists of the following files: -/data/datasetA/monthly/tas_20180101. nc -/data/datasetA/monthly/tas_20180201. nc -/data/datasetA/monthly/tas_20180301. nc, the path pattern to express the set of files would be as follows: /data/datasetA/$STORE_FREQ$/$VAR_NAME$_$ START_DATE$. nc. Use case 1 (Sect. 3. 1) directly loads wind speed (on the surface for the case of SEAS5 and at 100 m for the case of ERA5). However, this variable is not directly available in the Copernicus Climate Data Store (CDS) while u and v wind components are in 6 h and monthly frequencies.
In order to obtain the monthly wind speed, the 6 h frequency components are used to calculate the 6 h wind speed and then to calhttps://doi. org/10. 5194/gmd-15-6115-2022 Geosci. Model Dev. , 15, 6115-6142, 2022 culate the monthly average of the wind speed using Climate Data Operators (CDOs;  Schulzweida, 2019). Notice that averaging the monthly wind components may lead to a different result. To automate this calculation on all the files in a folder, the following batch code could be adapted: An equivalent script, using the CDO dailymean operator, can be used to convert the required variables in use cases 2 and 3 into daily mean values after the datasets are downloaded. crps_min, which corrects the bias, the overall forecast variance, and the ensemble spread and minimizes the continuous ranked probability score (CRPS), and  Van Schaeybroeck and Vannitsem (2015)  rpc-based, which adjusts the forecast variance, ensuring that the ratio of predictable components (RPC) is equal to one.
Acknowledgements. This work has been performed in the framework of the  MEDSCOPE (MEDiterranean Services Chain based On climate PrEdictions )  ERA4CS  project (grant no. 690462 ), with contributions from the  Sub-seasonal to Seasonal climate forecasting for Energy  ( S2S4E ; grant no. 776787 ) and the European Climate Prediction system (EUCP; grant no. 776613 ) from the  European Union 's  Horizon 2020 research and innovation programme. CDT acknowledges the funding by the  Spanish Ministry for Science and Innovation  (grant no. FPI PRE2019-088646 ). We thank following contributors to the CSTools package:  Filippo Calì Quaglia ,  Chihchung Chou ,  Nicola Cortesi ,  Paolo Davini ,  Raül Marcos ,  Niti Mishra ,  Jesus Peña ,  Francesc Roura-Adserias , and  Danila Volpi. We also thank  Margarida Samso , for the support on data formatting,  An-Chi Ho  for the work on s2dv, s2dverification and startR packages, and  Kim Serradell  and  Francesco Benincasa , for the technical support.
The  R community  and especially the developers of the packages rainfarmr, multiApply, ClimProjDiags, ncdf4, plyr, abind, data. table,reshape2, ggplot2, qmap, RColorBrewer, verification, zeallot, testthat, knitr, markdown, and rmarkdown are sincerely acknowledged, in addition to the CDO developers. Financial support. This research has been supported by the  Horizon 2020  ( S2S4E ; grant no. 776787 ),  EUCP  (grant no. 776613 ),  ERA4CS  (grant no. 690462 ), and the  Ministerio de Ciencia e Innovación  (grant no. FPI PRE2019-088646 ). Review statement. This paper was edited by  Jinkyu Hong  and reviewed by  Alfonso Senatore ,  Matteo De Felice , and one anonymous referee.
Data availability. The data sets used in this article are available from the CDS (https://cds. climate. copernicus. eu/ last access: 1 August 2022), which are the SEAS5 (Johnson et al. , 2019; ECMWF long-range forecasting system SEAS5), the ERA5  (Hersbach et al. , 2020)  and the ERA5-Land data (Muñoz-Sabater et al. , 2021), the CHIRPS  (Funk et al. , 2015 ; Climate Hazards group Infrared Precipitation with Stations; https://data. chc. ucsb. edu/products/CHIRPS-2. 0/, last access: 24 July 2022), and in the WorldClim2  (Fick and Hijmans, 2017 ; http://www. worldclim. com/version2, last access: 1 August 2022). Code availability. CSTools is released under the Apache License version 2. 0. The latest release of CSTools 4. 0. 1 is publicly available from a CRAN repository https://CRAN. R-project.