# Designing and Implementing Weather Generators as Web Services
## 1 Introduction  
Weather generators are statistical models, which are useful for generating synthetic weather sequences or weather realizations [1]. They are essential for crop yield predictions and risk assessment because of their ability to simulate seasonal climate in advance of the growing season. Sub-seasonal to seasonal (S2S) forecast, from two weeks to seasonal time scales, are now being developed by World Meteorological Organization (WMO) [2], which can be complemented by weather generators. In cropgrowth models, weather generators are an integral part for simulating crop growth and distributions of expected yields [3]. Together with crop models, they are used for implementing decision support systems for agricultural risk management related to climate and weather uncertainties. The results of crop models can provide expected yield distributions to farmers, e.g., the ones provided by Tomorrow's Crop framework [4]. The resulting yield distributions represent not only the average value but crop yield's stability and associated risks, which are more useful information for decision making. Daily weather realizations from weather generators have been used not only in agriculture but also in various fields, such as water engineering design, ecosystem and climate change simulations, because observed meteorological data are often inadequate in terms of their temporal and spatial coverages [3]. They have been utilized to fill up missing historical data, assess the impact of climate change such as droughts, rainfall pattern change and extreme temperature [3]. Most of the weather generators have been developed as stand-alone programs using programming languages suitable for scientific computations, such as Fortran and Pascal. However, stand-alone programs developed in these programming languages cannot readily serve clients over the Internet as a service, and cannot be linked with other web services, e.g., web-based simulations. In this regard, the usability of weather generators is limited. Similarly, weather generators' output formats can vary and metadata are not included resulting in their lack of portability and interoperability. Nowadays, some climatological data are available online, e.g., IRI/LDEO Climate Data Library [5], daily Agro-meteorological Grid Square Data System [6], among others, that can be retrieved and transferred over the Internet, however, their data formats and Application Program Interface (API) are oftentimes different. Weather generators have been developed as standalone applications, while decision support systems (DSS) for farm management are now being developed as web applications. Processing and providing climate and weather data for DSS web applications, however, is still a bottleneck. We encountered these gaps when we integrated a weather generator with a crop model for simulating crop yields in Tomorrow's Rice web-based framework [4]. We needed to work on developing iterative data processing, starting from querying data from climatological data sources, followed by data quality control since weather generator could not process incomplete data series (contained missing data), and lastly formatting the data to make them compatible as input to the weather generator model. Moreover, legacy weather generators, written in different programming languages such as Delphi and Pascal, are not really portable, hence a significant effort has to be spent on compiling them and keeping them up-to-date for different Operating Systems (OS). Intergovernmental Panel on Climate Change (IPCC) reported that environment and climate scientists had to spend huge time and effort in data handling [7]. These processes are time-consuming and require meteorological knowledge and programming skills. For pre-processing data such as filling missing data and data formatting, most of agronomists who run crop simulations do it manually or develop individual programs as they need. These bottlenecks must be addressed in order to increase efficiency of research and development in agriculture.