# Designing and Implementing Weather Generators as Web Services
## 3 Design and Implementation
### Web Service Server
#### 3.3.3 Weather Realization Sharing Service
\[\text{scenario\_n\_generator\_G\_climateforecast\_C\_foi\_XX} \tag{2}\]  
**where**  
_scenario is a constant word;_  
_n is a scenario number of weather realization;_  
_generator is a constant word; and_  
_G is name of weather generator which is used for generating weather realization._  
_In this research, DISAG refers to DisAg weather generator and PDISAG refers to PredictWTD weather generator._  
_Climate forecast is constant_  
_C refers to seasonal climate forecast scenario._  
_In this research, we only provide normal forecast, which is BN = 33, NN = 34, and AN = 33. The keyword to refer to is \"NORMAL\"._  
_foi is the abbreviation for feature of interest. It is used to refer to a specific location, which is a physical weather station name in source SOS._  
The URN of the first weather realization generated from historical weather data; foi = urn:IBUNYA:AMeDAS-NIAES:GAMAGOORI-51281 is generated by DISAG weather generator as scenario_1_generator_DISAG_climateforecast_NORMAL_foi_urn:IBUNYA:AMeDAS-NIAES:GAMAGOORI-51281  
* IWG for sharing weather realizations  
IWG is developed for improving efficiency of weather generator web service and promoting caching and sharing for weather realizations. IWG allows client to request weather realizations by specifying location in latitude and longitude with acceptable distance to weather station. Service endpoint of IWG and parameters are shown in Table 5.  
Example of HTTP GET [[http://ec2-52-69-188-223.ap-northeast-1.compute.amazonaws.com:8080/IWG_1/rest/scenarios?generator=DISAG&foi=lat:35.12](http://ec2-52-69-188-223.ap-northeast-1.compute.amazonaws.com:8080/IWG_1/rest/scenarios?generator=DISAG&foi=lat:35.12) lon:136.1 within:2.0&refresh=false]([http://ec2-52-69-188-223.ap-northeast-1.compute.amazonaws.com:8080/IWG_1/rest/scenarios?generator=DISAG&foi=lat:35.12](http://ec2-52-69-188-223.ap-northeast-1.compute.amazonaws.com:8080/IWG_1/rest/scenarios?generator=DISAG&foi=lat:35.12) lon:136.1 within:2.0&refresh=false). Figure 6 demonstrates the workflow for sharing weather realizations using IWG service and WSc SOS. When a user invokes service of IWG, IWG will first search for caching weather realizations on WSc SOS by issuing GetCapabilites request. If the list of available weather realizations matches user's request, the weather realizations are returned to user. If not, IWG invokes weather generator (WG) service for generating weather realizations and returns them to user. At the same time, the generated weather realizations are cached to WSc SOS using InsertObservation operation. An operator of this framework may use IWG to prepare weather realizations for all available historical weather data in order to give fast response to clients for a better service in a region. The weather realizations generated are stored in WCs SOS. User can invoke the service through SOS API. Service endpoint and parameters are explained in Table 6. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Service Endpoint** & [[http://ec2-52-69-188-223.ap-northeast-1.compute.amazonaws.com:8080/IWG_2/rest/scenarios?](http://ec2-52-69-188-223.ap-northeast-1.compute.amazonaws.com:8080/IWG_2/rest/scenarios?)]([http://ec2-52-69-188-223.ap-northeast-1.compute.amazonaws.com:8080/IWG_2/rest/scenarios?](http://ec2-52-69-188-223.ap-northeast-1.compute.amazonaws.com:8080/IWG_2/rest/scenarios?)) & \\ \hline
**HTTP GET Parameter** & **Description** & **Example** \\ \hline generator & Name of weather generator service & DISAG \\ \hline foi & Location in latitude and longitude with distance in unit of degree & lat:35.12 lon:136.1 within:2.0 \\ \hline refresh & This parameter is for telling the service if user allows caching data to be returned. & \\  & true: caching data is not accepted. The service must generate new weather realizations & true or false \\  & false: caching data is accepted & \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Request parameter of the IWG (Intermediate Weather Generator) service.