---
# System prepended metadata

title: Weather Map

---

# Weather Map 
## Design Spec
In this document we reference the `Requirements Spec` and focus on the implementation-independent design decisions.

## User Interface
- the weather map will only take in two arguments, and the call will be in the form of `weaterMap latitude longitude`

## Inputs and Outputs
*Input:* floating point latitude and longitude

*Output:* is an XML format weather report for the closest weather station or string out of bounds if there is no weather station within 100 miles. The XML formatted weather report includes:
    - lat
    - long
    - horizontal distance to nearest station
    - station code and descriptive name
    - timestamp for current obs
    - the current obs 

## Functional Decomposition into modules 
We anticipate the following modules and functions:
1. *Main*, which calls parseArgs, initializes the modules
2. *parseArgs*, which takes the two inputs, verifies they are ints and returns if sucessful, else return err
3. *horizontalDist* which takes in four ints, lat and long for the requested point, as well as the lat and long for a known weather station
4. *getStations*, which fetches all of the weather stations on the website 
5. *map* a stuct module that stores the results get stations inside of a quadtree, organizing by lat and long coordinates for a quick retrieval
6. 'currObservation', which is stored in the map as well and constructed in 'getStations' which has the name of the weather station as the main key and stores the weather condition, temp, wind speed, and humidity
7. 'findNearest' which takes the desired lat and long, looks up in map, uses horizontalDist func, and returns the closest weather or a string out of bounds if no weather station is within 100 miles.
## Pseudo Code 

## Major Data Structuress
- XML output that is fetched from the weather website
- the map (quadtree) that holds the lat and long points, as well as the currObservation object, which holds the weather condittions


## Testing Plan