This is the documentation for the network inference algorithm described in
"A network-based method for the study of climate teleconnections"

---------------------------------------------------------------------------------------------------
The program was compiled using the Netbeans 7.0 IDE

---------------------------------------------------------------------------------------------------
Folders

src : Source .java files (documentation of the routines available in each .java file).
dist: Contains an executable .jar file.
mylib: jmatio library used to load matlab files in java (http://www.mathworks.com/matlabcentral/fileexchange/10759).
testFiles: Test files to produce a network using HadlSST 1979-2005 DJF SSTs

---------------------------------------------------------------------------------------------------
The input to the program is a file with the detrended anomaly time series of a given climate field
and the areas identified by the area identification algorithm.

Example usage :

java -Xmx6g -jar NetworkInference.jar matlab_file  area_file

Output:

allCorrelations.txt : File containing pairwise correlations between the cumulative anomaly vectors of the areas.
areaSize.txt : File containing the distribution of area sizes (in terms of number of cells).
AreaStrengths.txt : File containing the distribution of area strengths.
finalGraph.clm : File containing the climate network represented by a .clm file format (see below for format specification).
finalGraph.net : File containing the climate network represented by a .net file format.
linkWeightsAreas.txt : File containing the link weight distribution.
map_score.txt : File containing an M by N array. Each cell in the array corresponds to a cell in a given area. The value of each cell corresponds to the actual s-core value of an area.
map_score_ranked.txt : File containing an M by N array. Each cell in the array corresponds to a cell in a given area. The value of each cell corresponds to the actual rank of the s-core value of an area.
map_strength.txt : File containing an M by N array. Each cell in the array corresponds to a cell in a given area. The value of each cell corresponds to the actual strength of an area.
mapwithAllAreas.txt : File containing an M by N array. Each cell in the array corresponds to a cell in a given area. The value of each cell corresponds to a random id assigned to that area.
stdAndSize.txt : Standard deviation of an areas cumulative anomaly vs. the areas size (in terms of number of cells).
str_linkColormap_area_X.txt : An M by N array showing the links from the Xth strongest area.
trueAreaSize.txt : Distribution of true (geographical) area sizes.

In order to visualize the M by N arrays representing color maps the authors used the m_map library
(http://www2.ocgy.ubc.ca/~rich/map.html) for matlab. A very simple visualization can be also achieved
using matlabs pcolor routine.

---------------------------------------------------------------------------------------------------
.clm file format description:

The .clm file format is very similar to the .net format (https://gephi.org/users/supported-graph-formats/pajek-net-format/) and is used to 
represent the climate network. Apart from the nodes of the network it keeps information on which grid cells belong to which area.

Example:

Vertices 2
1
1000 1001 10002 1003
2
5000 5001
Edges 1
1	2	-1000

The example above represents a climate network with 2 areas, each area has a unique id (1 and 2 in our case). Area 1 has four cells with
ids 1000 1001 10002 1003 and area 2 has 2 cells with ids 5000 and 5001. The network has only 1 edge with the edge weight equal to -1000.

---------------------------------------------------------------------------------------------------
A note on the ids of grid cells:

It is obvious that each grid cell has a unique id. Given a M by N grid each cell will have an id according to
the following rule

1	2	...	...	N
N+1	N+2	...	...	2N
...	...	...	...	...
...	...	...	...	...
...	...	...	...	...
...	...	...	...	...
(M-1)N+1...	...	..,	MN