diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..56ab065 --- /dev/null +++ b/404.html @@ -0,0 +1,387 @@ + + + + + + + + + + + + + + + + + + + + +G2S: The GeoStatistical Server | A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+ + +
+

404

+ +

Page not found :(

+

The requested page could not be found.

+
+ +
+
+
+ + + \ No newline at end of file diff --git a/about/index.html b/about/index.html new file mode 100644 index 0000000..d5a2b78 --- /dev/null +++ b/about/index.html @@ -0,0 +1,10 @@ +

This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at jekyllrb.com

+ +

You can find the source code for Minima at GitHub: +jekyll / +minima

+ +

You can find the source code for Jekyll at GitHub: +jekyll / +jekyll

+ diff --git a/algorithms.html b/algorithms.html new file mode 100644 index 0000000..f1c8877 --- /dev/null +++ b/algorithms.html @@ -0,0 +1,376 @@ + + + + + + + + + + + + + + + + + + + + +Algorithms | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

Algorithms

+ +
    +
  • QuickSampling (QS) (aka. Quantile Sampling) is a general-purpose pixel-based MPS algorithm that is designed to be robust, efficient, and run in constant time. QS was designed to adapt to your problem; it can be used to do (un)conditional simulation, gap filling, or even downscaling, using continuous or categorical variables or a combination of both. The code was developed without restrictions regarding the dimensionality of the data (e.g. 1D, 2D, 3D, nD).
  • +
  • Narrow Distribution Selection (NDS) is an algorithm specifically targeted to simulate spectrally enhanced remote-sensed imagery. It requires an external variable (for example, a grayscale image) to control the simulation (of colors).
  • +
+ +

The framework can be easily extended to handle most codes that use gridded data. Currently, any compiled code or Python code can be handled.

+ +
+
+
+ + + \ No newline at end of file diff --git a/algorithms/AutoQS.html b/algorithms/AutoQS.html new file mode 100644 index 0000000..2c958a4 --- /dev/null +++ b/algorithms/AutoQS.html @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + +QuickSampling | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

AutoQS

+ +

Parameters for AutoQS

+ +

TODO

+ +

Examples

+ +

TODO

+ +

Publication

+ +

**

+ + +
+
+
+ + + \ No newline at end of file diff --git a/algorithms/NarrowDistributionSelection.html b/algorithms/NarrowDistributionSelection.html new file mode 100644 index 0000000..0c58979 --- /dev/null +++ b/algorithms/NarrowDistributionSelection.html @@ -0,0 +1,472 @@ + + + + + + + + + + + + + + + + + + + + +QuickSampling | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

+Parameters for NDS

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FlagDescriptionMandatory
-tiTraining images (one or more images). If multivariate, the last dimension should be the same size as the number of variables, and should also match the size of the array given for the parameter dt. NaN values in the training image will be ignored. Unlike other MPS-algorithms, if there are multiple variables they will not be automatically normalized to be in the same range.
-diDestination image (one image, aka simulation grid). The size of di will be the size of the simulation grid. di can be identical as ti for gap-filing. NaN values will be simulated. Non-NaN values will be considered as conditioning data.
-dtData type. 0 -> continuous and 1 -> categorical. This is where the number of variables is defined. If multiple variables, use a single N value if identical for all variables or use an array of N values if each variable has a different N.
-kNumber of best candidates to consider to compute the narrowness, range [5, inf].
-nN closest neighbors to consider.
-kiImage of the weighting kernel. Can be used to normalize the variables. If multiple variables, use a single kernel value if identical for all variables. If each variable has a different kernel, stack all kernels along the last dimension. The number of kernels should then match the size of the array given for the parameter dt. 
-nwNarrowness range: 0 -> max-min, 1 -> median, default IQR -> 0.5. 
-nwvNumber of variables to consider in the narrowness (start from the end), default: 1. 
-csChunk size, the number of pixels to simulate at the same time, at each iteration, default: 1. 
-udsArea to update around each simulated pixel, the M closest pixel default: 10. 
-mpPartial simulation, 0 -> empty, 1 -> 100%. 
-sSeed value. 
-jTo run in parallel (default is single core). To use as follows: -j, N1, N2, N3 (all three are optional but N3 needs N2, which in turn needs N1). Use integer values to specify a number of threads (or logical cores). Use decimal values ∈ ]0,1[ to indicate fraction of the maximum number of available logical cores (e.g., 0.5=50% of all available logical cores). N1 threads used to parallelize the path (path-level) Default: the maximum number of threads available. N2 threads used to parallelize over training images (if many TIs are available, each is scanned on a different core). Default: 1. N3 threads used to parallelize FFTs (node-level). Default: 1. N1 and N2 are recommended over N3. N1 is usually more efficient than N2, but requires more memory. 
-W_GPUUse integrated GPU if available. 
-nVNo Verbatim (experimental). 
+ +

+Examples

+ +

+Publication

+ +

Gravey, M., Rasera, L. G., & Mariethoz, G. (2019). Analogue-based colorization of remote sensing images using textural information. ISPRS Journal of Photogrammetry and Remote Sensing, 147, 242–254. https://doi.org/10.1016/j.isprsjprs.2018.11.003

+ + +
+
+
+ + + \ No newline at end of file diff --git a/algorithms/QuickSampling.html b/algorithms/QuickSampling.html new file mode 100644 index 0000000..e9aa354 --- /dev/null +++ b/algorithms/QuickSampling.html @@ -0,0 +1,1546 @@ + + + + + + + + + + + + + + + + + + + + +QuickSampling | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

QuickSampling QS

+ +

+Parameters for QS

+ +

Usage: [sim,index,time,finalprogress,jobid] = g2s(flag1,value1, flag2,value2, ...) +Outputs: sim = simulation, index = index of the simulated values in the flattened TI, time = simulation time, finalprogress = final progression of the simulation (normally 100), jobid = job ID.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FlagDescriptionMandatory
-tiTraining images (one or more images). If multivariate, the last dimension should be the same size as the number of variables, and should also match the size of the array given for the parameter dt. NaN values in the training image will be ignored. Unlike other MPS-algorithms, if there are multiple variables they will not be automatically normalized to be in the same range.
-diDestination image (one image, aka simulation grid). The size of di will be the size of the simulation grid. di can be identical as ti for gap-filing. NaN values will be simulated. Non-NaN values will be considered as conditioning data.
-dtData type. 0 → continuous and 1 → categorical. This is where the number of variables is defined. Provide a list containing zeros or ones representing the data type of each variable.
-kNumber of best candidates to consider ∈ [1 ∞].
-nN closest neighbors to consider. If multiple variables: use a single N value if identical for all variables or use an array of N values if each variable has a different N.
-kiImage of the weighting kernel. Can be used to normalize the variables. If multiple variables: use a single kernel value if identical for all variables or if each variable has a different kernel, stack all kernels along the last dimension. The number of kernels should then match the size of the array given for the parameter dt. 
-ff=1/k equivalent to f of DS with a threshold to 0. 
-jTo run in parallel (default is single core). To use as follows ‘-j’, N1, N2, N3 (all three are optional but N3 needs N2, which in turn needs N1). Use integer values to specify a number of threads (or logical cores). Use decimal values ∈]0,1[ to indicate fraction of the maximum number of available logical cores (e.g., 0.5=50% of all available logical cores). N1 threads used to parallelize the path (path-level) Default: the maximum number of threads available. N2 threads used to parallelize over training images (if many TIs are available, each is scanned on a different core). Default: 1. N3 threads used to parallelize FFTs (node-level). Default: 1. N1 and N2 are recommended over N3. N1 is usually more efficient than N2, but requires more memory. 
-spSimulation path, array of the size of the simulation grid containing values that specify the simulation path (from low to high). Default is a random path. Equal values are accepted but will always be ordered in the same way (i.e. not random). -∞ values are not simulated. In case of multiple variables, a vector simulation is default (same path for all variables) and the simulation path should be one dimension less than the number of variables. If you prefer a full simulation, provide an array containing the path for each variable and use the “-fs” flag below. 
-sRandom seed value. 
-W_GPUUse integrated GPU if available. 
-W_CUDAUse Nvidia Cuda compatible GPU: specify the device id. (e.g., '-W_CUDA',0,1 to use the first two GPUs). 
+ +

+Advanced parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FlagDescriptionMandatory
-iiArray that specifies for each pixel which training image to sample from. Default: all training images are searched for the best match. 
-farFast and risky 😄, like -ii but with a random input (experimental). 
-ctiWith this flag QS will treat the training image(s) as periodic (aka circular or cyclic) over each dimension. 
-csimWith this flag QS will make sure to create a periodic (aka circular or cyclic) simulation over each dimension. 
-adsimAugmented dimentionality simulation: allows for 3D simulation using 2D training image, only for categories (Coming maybe some day!). 
-fsFull simulation: follows a different simulation path for each variable (as opposed to vector simulation, where the same simulation path is used for all variables). 
-nVNo Verbatim, i.e. prohibits neighbors in the training image to be neighbors in the simulation. (experimental). 
+ +

+Examples

+

Below are several examples showcasing different applications of QS. For these examples the G2S server should be installed and running, either on your own machine or remotely. A Google Colab notebook with more examples and an automatic installation of G2S can be found here.

+ +

+Unconditional simulation

+ +
+

+ +

+
+
+
+
#This code requires the G2S server to be running
+
+import numpy
+from PIL import Image
+import requests
+from io import BytesIO
+from g2s import g2s
+import matplotlib.pyplot as plt
+
+# load example training image ('stone')
+ti = numpy.array(Image.open(BytesIO(requests.get(
+    'https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/stone.tiff').content)));
+
+# QS call using G2S
+simulation,*_=g2s('-a','qs',
+                 '-ti',ti,
+                 '-di',numpy.zeros((200,200))*numpy.nan,
+                 '-dt',[0], #Zero for continuous variables
+                 '-k',1.2,
+                 '-n',50,
+                 '-j',0.5);
+
+#Display results 
+fig, (ax1, ax2) = plt.subplots(1, 2,figsize=(7,4))
+fig.suptitle('QS Unconditional simulation',size='xx-large')
+ax1.imshow(ti)
+ax1.set_title('Training image');
+ax1.axis('off');
+ax2.imshow(simulation)
+ax2.set_title('Simulation');
+ax2.axis('off');
+plt.show()
+
+
+
+
+
+
%This code requires the G2S server to be running
+
+%load data
+ti=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/stone.tiff');
+
+% QS call using G2S
+simulation=g2s('-a','qs','-ti',ti,'-di',nan(200,200),'-dt',[0],'-k',1.2,'-n',50,'-j',0.5);
+
+%Display results 
+sgtitle('Unconditional simulation');
+subplot(1,2,1);
+imshow(ti);
+title('Training image');
+subplot(1,2,2);
+imshow(simulation);
+title('Simulation');
+
+
+
+ +

+Conditional simulation

+ +
+

+ +

+
+
+
+
#This code requires the G2S server to be running
+
+import numpy
+from PIL import Image
+import requests
+from io import BytesIO
+from g2s import g2s
+import matplotlib.pyplot as plt
+
+# load example training image ('stone')
+ti = numpy.array(Image.open(BytesIO(requests.get(
+    'https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/stone.tiff').content)));
+
+# create empty grid and add conditioning data
+conditioning = numpy.zeros((200,200))*numpy.nan; 
+# fill the grid with 50 random points
+conditioning.flat[numpy.random.permutation(conditioning.size)[:50]]=ti.flat[numpy.random.permutation(ti.size)[:50]];
+
+# QS call using G2S
+simulation,*_=g2s('-a','qs', 
+                 '-ti',ti,
+                 '-di',conditioning,
+                 '-dt',[0],
+                 '-k',1.2,
+                 '-n',30,
+                 '-j',0.5);
+
+# Display results 
+fig, (ax1, ax2, ax3) = plt.subplots(1, 3,figsize=(7,4),subplot_kw={'aspect':'equal'})
+fig.suptitle('QS Conditional simulation',size='xx-large',y=0.9)
+ax1.imshow(ti)
+ax1.set_title('Training image');
+ax1.axis('off');
+ax2.scatter(*numpy.meshgrid(numpy.arange(200),numpy.arange(200,0,-1)),s=5,c=conditioning,marker='.')
+ax2.set_title('Conditioning');
+ax2.axis('off');
+ax3.imshow(simulation)
+ax3.set_title('Simulation');
+ax3.axis('off');
+plt.show()
+
+
+
+
+
+
%This code requires the G2S server to be running
+
+%load data
+ti=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/stone.tiff');
+% empty grid 
+conditioning=nan(200,200); 
+% fill the grid with 50 random points
+conditioning(randperm(numel(conditioning),50))=ti(randperm(numel(ti),50));
+
+% QS call using G2S
+simulation=g2s('-a','qs','-ti',ti,'-di',conditioning,'-dt',[0],'-k',1.2,'-n',50,'-j',0.5);
+
+%Display results 
+sgtitle('Conditional simulation');
+subplot(1,3,1);
+imshow(ti);
+title('Training image');
+subplot(1,3,2);
+imshow(conditioning);
+title('Conditioning');
+subplot(1,3,3);
+imshow(simulation);
+title('Simulation');
+
+
+
+ +

+Simulation with multiple Training Images

+ +
+

+ +

+
+
+
+
#This code requires the G2S server to be running
+
+import numpy
+from PIL import Image
+import requests
+from io import BytesIO
+from g2s import g2s
+import matplotlib.pyplot as plt
+
+#ti1 contains horizontal lines and ti2 vertical lines
+ti1 = numpy.tile(numpy.sin(range(150)),(150,1))
+ti2 = ti1.transpose()
+
+# QS call using only the horizontal lines as TI
+simulation1,index1,*_ = g2s('-a','qs',
+                         '-ti',ti1,
+                         '-di',numpy.zeros((150,150))*numpy.nan,
+                         '-dt',[1], #1 for categorical variable
+                         '-k',1.2,
+                         '-n',25,
+                         '-j',0.5);
+
+# QS call using both horizontal and vertical lines as TI's
+simulation2,index2,*_ = g2s('-a','qs',
+                         '-ti',[ti1,ti2],
+                         '-di',numpy.zeros((150,150))*numpy.nan,
+                         '-dt',[1],
+                         '-k',1.2,
+                         '-n',25,
+                         '-j',0.5);
+
+#Display results
+fig, ([[ax1,ax2],[ax3,ax4]]) = plt.subplots(2,2,figsize=(10,10),sharex = True,sharey = True)
+fig.suptitle('QS Multiple TI simulation',size='xx-large')
+ax1.imshow(ti1)
+ax1.set_title('Training image 1');
+ax1.axis('off');
+ax2.imshow(ti2)
+ax2.set_title('Training image 2');
+ax2.axis('off');
+ax3.imshow(simulation1)
+ax3.set_title('Simulation 1');
+ax3.axis('off');
+ax4.imshow(simulation2)
+ax4.set_title('Simulation 2');
+ax4.axis('off');
+
+
+
+
+
+
%This code requires the G2S server to be running
+
+%ti1 contains horizontal lines and ti2 vertical lines
+ti=repmat((sin(1:150)>0)',1,150);
+ti1=ti;
+ti2=rot90(ti,1);
+
+%QS call using only the horizontal lines as TI
+simulation1=g2s('-a','qs', ...
+            '-di',nan(150,150,1), ...
+            '-ti',{ti1}, ...
+            '-dt',[1], ...
+            '-k',1.2, ...
+            '-n',25, ...
+            '-j',0.5);
+
+% QS call using both horizontal and vertical lines as TI's
+simulation2=g2s('-a','qs', ...
+            '-di',nan(150,150,1), ...
+            '-ti',{ti1 ti2}, ...
+            '-dt',[1], ...
+            '-k',1.2, ...
+            '-n',25, ...
+            '-j',0.5);
+
+%Display results 
+figure(4);clf
+sgtitle('multi-TI');
+subplot(2,2,1);
+imshow(ti1);
+title('Training image 1');
+subplot(2,2,2);
+imshow(ti2);
+title('Training image 2');
+subplot(2,2,3);
+imshow(simulation1);
+title('Simulation with training image 1');
+subplot(2,2,4);
+imshow(simulation2);
+title('Simulation with training images 1 and 2');
+
+
+
+ +

+Multivariate simulation

+ +
+

+ +

+
+
+
+
#This code requires the G2S server to be running
+
+import numpy
+import requests
+from io import BytesIO
+from g2s import g2s
+import matplotlib.pyplot as plt
+import tifffile as tf
+
+ti = tf.imread(BytesIO(requests.get(
+    'https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/ti_3_variables.tiff').content))
+
+###Example 1 - Complete multivariate simulation
+#Here all three variables are entirely unkwown and will be simulated simultaneously
+
+# QS call using G2S (with dt set to two continuous and one categorical variable)
+simulation1,index1,*_=g2s('-a','qs',
+                 '-ti',ti,
+                 '-di',numpy.zeros([400,400,3])*numpy.nan,
+                 '-dt',[0,0,1],
+                 '-k',1.2,
+                 '-n',50,
+                 '-j',0.5);
+
+#Display results 
+fig, ([[ax1,ax2,ax3],[ax4,ax5,ax6],[ax7,ax8,ax9]]) = plt.subplots(3,3,figsize=(15,10),sharex = True,sharey = True)
+fig.suptitle('QS Multivariate simulation - example 2',size='xx-large')
+ax1.imshow(ti[:,:,0])
+ax1.set_title('Training image dim 1');
+ax1.axis('off');
+ax2.imshow(ti[:,:,1])
+ax2.set_title('Training image dim 2');
+ax2.axis('off');
+ax3.imshow(ti[:,:,2])
+ax3.set_title('Training image dim 3');
+ax3.axis('off');
+ax4.imshow(numpy.zeros([400,400])*numpy.nan)
+ax4.set_title('Destination image dim 1')
+ax4.axis('off')
+ax5.imshow(numpy.zeros([400,400])*numpy.nan)
+ax5.set_title('Destination image dim 2')
+ax5.set_aspect('equal')
+ax5.axis('off')
+ax6.imshow(numpy.zeros([400,400])*numpy.nan)
+ax6.set_title('Destination image dim 3')
+ax6.axis('off')
+ax7.imshow(simulation1[:,:,0])
+ax7.set_title('Simulation dim 1');
+ax7.axis('off');
+ax8.imshow(simulation1[:,:,1])
+ax8.set_title('Simulation dim 2');
+ax8.axis('off');
+ax9.imshow(simulation1[:,:,2])
+ax9.set_title('Simulation dim 3');
+ax9.axis('off');
+
+
+
+### Example 2 - Multivariate simulation with partially informed covariables
+#In many situations we will have fully and/or partially informed covariables (e.g. topography + point measurements)
+#To simulate a different environment than the training images, we will use the results from example 1 above
+#Variable 2 is partially informed and variable 3 is fully informed
+
+#Take random values from the previous simulation of variable 2 and add them to the di
+di_var2 = numpy.zeros([400,400])*numpy.nan
+di_var2.flat[numpy.random.permutation(di_var2.size)[:500]] = ti[:,:,1].flat[numpy.random.permutation(ti[:,:,1].size)[:500]]
+di_example2 = numpy.stack([numpy.zeros([400,400])*numpy.nan,
+                                 di_var2,
+                                 simulation1[:,:,2]],axis = 2)
+
+# QS call using G2S (with dt set to two continuous and one categorical variable)
+simulation2,index,*_=g2s('-a','qs',
+                 '-ti',ti,
+                 '-di',di_example2,
+                 '-dt',[0,0,1],
+                 '-k',1.2,
+                 '-n',50,
+                 '-j',0.5);
+
+#Display results 
+fig, ([[ax1,ax2,ax3],[ax4,ax5,ax6],[ax7,ax8,ax9]]) = plt.subplots(3,3,figsize=(15,10),sharex = True,sharey = True)
+fig.suptitle('QS Multivariate simulation - example 2',size='xx-large')
+ax1.imshow(ti[:,:,0])
+ax1.set_title('Training image dim 1');
+ax1.axis('off');
+ax2.imshow(ti[:,:,1])
+ax2.set_title('Training image dim 2');
+ax2.axis('off');
+ax3.imshow(ti[:,:,2])
+ax3.set_title('Training image dim 3');
+ax3.axis('off');
+ax4.imshow(di_example2[:,:,0])
+ax4.set_title('Destination image dim 1')
+ax4.axis('off')
+ax5.scatter(*numpy.meshgrid(numpy.arange(400),numpy.arange(400,0,-1)),s=5,c=di_example2[:,:,1],marker='.')
+ax5.set_title('Destination image dim 2')
+ax5.set_aspect('equal')
+ax5.axis('off')
+ax6.imshow(di_example2[:,:,2])
+ax6.set_title('Destination image dim 3')
+ax6.axis('off')
+ax7.imshow(simulation2[:,:,0])
+ax7.set_title('Simulation dim 1');
+ax7.axis('off');
+ax8.imshow(simulation2[:,:,1])
+ax8.set_title('Simulation dim 2');
+ax8.axis('off');
+ax9.imshow(simulation2[:,:,2])
+ax9.set_title('Simulation dim 3');
+ax9.axis('off');
+
+
+
+
+
+
+
%This code requires the G2S server to be running
+
+%load data
+ti=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/ti_3_variables.tiff');
+
+% QS call using G2S (with dt set to two continuous and one categorical
+% variable)
+simulation=g2s('-a','qs','-ti',ti,'-di',nan(400,400,3),'-dt',[0,0,1],'-k',1.2,'-n',30,'-j',0.5);
+
+%Display results 
+sgtitle('Unconditional simulation');
+subplot(2,3,1);
+imshow(ti(:,:,1));
+title('Training image dim 1');
+subplot(2,3,2);
+imshow(ti(:,:,2));
+title('Training image dim 2');
+subplot(2,3,3);
+imshow(ti(:,:,3));
+title('Training image dim 3');
+subplot(2,3,4);
+imshow(simulation(:,:,1));
+title('Simulation dim 1');
+subplot(2,3,5);
+imshow(simulation(:,:,2));
+title('Simulation dim 2');
+subplot(2,3,6);
+imshow(simulation(:,:,3));
+title('Simulation dim 3');
+colormap winter;
+
+
+
+ +

+Gap filling

+ +
+

+ +

+
+
+
+
#This code requires the G2S server to be running
+
+import numpy
+from PIL import Image
+import requests
+from io import BytesIO
+from g2s import g2s
+import matplotlib.pyplot as plt
+
+# load example training image ('stone') and cut out a part of it
+tiWithGap = numpy.array(Image.open(BytesIO(requests.get(
+    'https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/stone.tiff').content)));
+tiWithGap[60:140,60:140]=numpy.nan;
+
+# QS call using G2S
+simulation,*_=g2s('-a','qs',
+                 '-ti',tiWithGap,
+                 '-di',tiWithGap,
+                 '-dt',[0],
+                 '-k',1.2,
+                 '-n',25,
+                 '-j',0.5);
+
+#Display results 
+fig, (ax1, ax2) = plt.subplots(1, 2,figsize=(7,4))
+fig.suptitle('QS Gap filling',size='xx-large')
+ax1.imshow(tiWithGap)
+ax1.set_title('Training image');
+ax1.axis('off');
+ax2.imshow(simulation)
+ax2.set_title('Simulation');
+ax2.axis('off');
+plt.show()
+
+
+
+
+
+
%This code requires the G2S server to be running
+
+%load data
+tiWithGap=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/stone.tiff');
+tiWithGap(60:140,60:140)=nan;
+
+% QS call using G2S
+simulation=g2s('-a','qs','-ti',tiWithGap,'-di',tiWithGap,'-dt',[0],'-k',1.2,'-n',25,'-j',0.5);
+
+%Display results 
+sgtitle('Gap filling');
+subplot(1,2,1);
+imshow(tiWithGap);
+title('Training image');
+subplot(1,2,2);
+imshow(simulation);
+title('Simulation');
+
+
+
+ +

+Downscaling

+ +
+

+ +

+
+
+
+
#This code requires the G2S server to be running
+
+import numpy as np
+from PIL import Image
+from g2s import g2s
+import matplotlib.pyplot as plt
+from matplotlib import colors
+from io import BytesIO
+import requests
+
+#Load example training image "Dunes gobi"
+ti_full = Image.open(BytesIO(requests.get(
+    'https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/dunes_gobi.tiff').content))
+#Keep one version at fine resolution
+ti_fine = np.array(ti_full)
+#Make a synthetic coarse resolution image by upscaling and reprojecting to the original grid 
+ti_coarse = np.array(ti_full.resize(
+    (int(ti_full.width/5),int(ti_full.height/5))).resize(
+    (ti_full.width,ti_full.height),resample=Image.NEAREST))
+
+#Display the full training image at both resolutions
+norm =colors.Normalize(vmin=ti_fine.min(),vmax=ti_fine.max())
+f,(ax1,ax2) = plt.subplots(2,1,figsize=(12,12))
+ax1.imshow(ti_fine,norm=norm)
+ax1.set_title('Fine resolution training image')
+ax2.imshow(ti_coarse, norm =norm)
+ax2.set_title('Coarse resolution training image')
+
+#Crop half of the image to be used as ti
+ti = np.stack((ti_fine[:500,:500],ti_coarse[:500,:500]),axis=2)
+#Crop upper right corner to be used as di
+di_coarse = ti_coarse[:200,-200:]
+di_fine   = np.zeros((200,200))*np.nan
+di=np.stack((di_fine,di_coarse),axis=2)
+#dt consists of two zeros representing two continuous variables
+dt = [0]*ti.shape[-1]
+
+# QS call using G2S
+simulation,index,*_=g2s('-a','qs',
+                         '-ti',ti,
+                         '-di',di,
+                         '-dt',dt,
+                         '-k',1.0,
+                         '-n',30,
+                         '-j',0.5)
+
+#Display results 
+norm =colors.Normalize(vmin=ti_fine.min(),vmax=ti_fine.max())
+f,((ax1,ax2),(ax3,ax4)) = plt.subplots(2,2,figsize=(12,12),sharex=True,sharey=True)
+plt.subplots_adjust(wspace=0.1,hspace=0.1)
+plt.suptitle('QS Downscaling',size='xx-large')
+ax1.imshow(di_coarse,norm=norm)
+ax1.set_title('Coarse res di')
+ax2.imshow(simulation[:,:,0], norm =norm)
+ax2.set_title('Simulation')
+ax3.imshow(index)
+ax3.set_title('Index')
+ax4.imshow(ti_fine[:200,-200:],norm=norm)
+ax4.set_title('True image')
+ax4.set_xticks(np.arange(0,200,25),np.arange(ti_full.width-200,ti_full.width,25));
+
+
+
+
+
+
%This code requires the G2S server to be running
+
+%load example training image 'Dunes gobi'
+ti_fine=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/dunes_gobi.tiff');
+
+%create an artificial coarse resolution image on the same grid 
+ti_coarse = imresize(imresize(ti_fine,0.2,'nearest'),5,'nearest');
+
+%display the full training image at both resolutions
+figure(1);
+tiledlayout(2,1);
+nexttile;
+image(ti_fine);
+title('Fine TI');
+nexttile;
+image(ti_coarse);
+title('Coarse TI');
+
+ti_size = 500;
+di_size = 200;
+
+%crop half of the image, to be used as ti
+ti = cat(3,ti_fine(1:ti_size,1:ti_size),ti_coarse(1:ti_size,1:ti_size));
+%crop upper right corner to be used as di
+di_coarse = ti_coarse(1:di_size,(end-di_size+1):end);
+di_fine  = nan(di_size,di_size);
+di = cat(3,di_fine,di_coarse);
+
+
+% QS call using G2S
+[simulation,index,time]=g2s('-a','qs',...
+                '-ti',ti,...
+                '-di',di,...
+                '-dt',[0 0],... #Zero for continuous variables
+                '-k',1.0,...
+                '-n',30,...
+                '-j',0.5);
+
+figure(2);
+tiledlayout(2,2)
+nexttile;
+image(di_coarse);
+title('Coarse DI');
+nexttile;
+image(simulation(:,:,1));
+title('Simulation');
+nexttile;
+image(index(:,:,1),'CDataMapping','scaled');
+title('Index');
+nexttile;
+image(ti_fine(1:di_size,(end-di_size+1):end));
+title('True image');
+
+
+
+
+
+ +

+3D simulation

+ +
+

+ +

+
+
+
+
#This code requires the G2S server to be running
+
+import numpy as np
+import requests
+from io import BytesIO
+from g2s import g2s
+import matplotlib.pyplot as plt
+import tifffile as tf
+from matplotlib import cm
+
+#Load example boolean training image "Damier 3D" and crop it to reduce computational requirements
+dim = 30
+ti = tf.imread(BytesIO(requests.get(
+    'https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/Damier3D.tiff').content))[:dim,:dim,:dim]
+
+# QS call using G2S
+simulation,index,time,*_=g2s('-a','qs',
+                             '-ti',ti,
+                             '-di',np.zeros_like(ti)*np.nan,
+                             '-dt',[1], #1 for categorical variables
+                             '-k',1.2,
+                             '-n',30)
+
+#Display results
+fig = plt.figure(figsize=(20,15))
+ax1=fig.add_subplot(121,projection='3d')
+ax1.voxels(ti,alpha=0.9,facecolor='tab:blue',edgecolor='black')
+ax1.view_init(azim=45)
+ax1.set_title('3D Training image')
+ax2=fig.add_subplot(122,projection='3d')
+ax2.voxels(simulation,alpha=0.9,facecolor='tab:blue',edgecolor='black')
+ax2.view_init(azim=45)
+ax2.set_title('QS 3D simulation')
+
+#Display the indices of the ti-values found in the di-image
+viridis = cm.get_cmap('viridis',index.max())
+colormap = viridis(index)
+fig = plt.figure(figsize=(10,10))
+ax1=fig.add_subplot(111,projection='3d')
+ax1.voxels(index,facecolors=colormap)
+ax1.view_init(azim=45);
+
+
+
+
+
+
%This code requires the G2S server to be running
+
+%% 3D multivariate
+
+clear;home;clf
+%download TI (first variable, continuous)
+ti1=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/fold_continuous.tiff');
+%create second variable (categorical) by thresholding the first
+ti2=ti1>0.5;
+ti=cat(4,ti1,ti2);
+ti=double(ti(1:80,1:50,101:120,:));
+
+%display TI
+subplot(2,2,1)
+[X,Y,Z] = meshgrid(1:size(ti,2),1:size(ti,1),1:size(ti,3));
+slice(X,Y,Z,ti(:,:,:,1),[1 size(ti,2)],[1 size(ti,1)],[1 size(ti,3)])
+shading flat
+camproj('perspective')
+axis equal
+title('TI variable 1');
+
+subplot(2,2,2)
+[X,Y,Z] = meshgrid(1:size(ti,2),1:size(ti,1),1:size(ti,3));
+slice(X,Y,Z,ti(:,:,:,2),[1 size(ti,2)],[1 size(ti,1)],[1 size(ti,3)])
+shading flat
+camproj('perspective')
+axis equal
+title('TI variable 2');
+
+% QS call using G2S
+tic
+simulation=g2s('-a','qs','-ti',ti,'-di',nan(80,50,10,2),'-dt',[0,1],'-k',1.2,'-n',{20 10},'-j',0.5);
+toc
+
+%display simulation
+subplot(2,2,3)
+[X,Y,Z] = meshgrid(1:size(simulation,2),1:size(simulation,1),1:size(simulation,3));
+slice(X,Y,Z,simulation(:,:,:,1),[1 size(simulation,2)],[1 size(simulation,1)],[1 size(simulation,3)])
+shading flat
+camproj('perspective')
+axis equal
+title('Simulation variable 1');
+
+subplot(2,2,4)
+[X,Y,Z] = meshgrid(1:size(simulation,2),1:size(simulation,1),1:size(simulation,3));
+slice(X,Y,Z,simulation(:,:,:,2),[1 size(simulation,2)],[1 size(simulation,1)],[1 size(simulation,3)])
+shading flat
+camproj('perspective')
+axis equal
+title('Simulation variable 2');
+sgtitle('3D Simulation with two variables');
+
+
+
+ +

+Asynchronous mode

+ +
+

+ +

+
+
+
+
#This code requires the G2S server to be running
+
+import numpy
+from PIL import Image
+import requests
+from io import BytesIO
+from g2s import g2s
+import matplotlib.pyplot as plt
+import time
+
+# load example training image ('stone')
+ti = numpy.array(Image.open(BytesIO(requests.get(
+    'https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/stone.tiff').content)));
+
+
+# asynchronous QS call using G2S with the "-submitOnly" flag
+jobid_1=g2s('-a','qs', 
+                 '-submitOnly',
+                 '-ti',ti,
+                 '-di',numpy.zeros((200,200))*numpy.nan,
+                 '-dt',[0],
+                 '-k',1.2,
+                 '-n',50,
+                 '-j',0.5);
+
+# second asynchronous call that waits for job 1 to finish using the "-after" flag
+jobid_2 = g2s('-a','qs', 
+                  '-after',jobid_1,
+                  '-submitOnly',
+                  '-ti',ti,
+                  '-di',numpy.zeros((200,200))*numpy.nan,
+                  '-dt',[0],
+                  '-k',1.2,
+                  '-n',50,
+                  '-j',0.5);
+
+# check the status of both jobs in 2-second intervals using the "-statusOnly" flag
+status_1 = 0
+status_2 = 0
+while status_2 < 95:
+    time.sleep(2)
+    status_1,*_ = g2s('-statusOnly',jobid_1)
+    status_2,*_ = g2s('-statusOnly',jobid_2)
+    print('Status jobs 1 & 2:   ', status_1,status_2)
+
+# retrieve the simulation results from the server using the "-waitAndDownload" flag
+# if the simulation would not be ready yet this call would wait for it to be ready
+sim1,*_ = g2s('-waitAndDownload',jobid_1)
+sim2,*_ = g2s('-waitAndDownload',jobid_2)
+
+# display results 
+fig, (ax1, ax2,ax3) = plt.subplots(1, 3,figsize=(7,4))
+fig.suptitle('QS Unconditional simulation',size='xx-large')
+ax1.imshow(ti)
+ax1.set_title('Training image');
+ax1.axis('off');
+ax2.imshow(sim1)
+ax2.set_title('Simulation 1');
+ax2.axis('off');
+ax3.imshow(sim2)
+ax3.set_title('Simulation 2');
+ax3.axis('off');
+plt.show()
+
+
+
+
+
+
%This code requires the G2S server to be running
+
+% load example traning image ('stone')
+ti=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/stone.tiff');
+
+% asynchronous QS call using G2S with the "-submitOnly" flag
+jobid_1=g2s('-a','qs','-submitOnly','-ti',ti,'-di',nan(200,200),'-dt',[0],'-k',1.2,'-n',50,'-j',0.5);
+
+% 2nd async call that waits for job 1 to finish using the "-after" flag
+jobid_2=g2s('-a','qs','-after',jobid_1,'-submitOnly','-ti',ti,'-di',nan(200,200),'-dt',[0],'-k',1.2,'-n',50,'-j',0.5);
+
+% check the status of both jobs in 2-second intervals using the
+% "-statusOnly" flag
+status_1 = 0;
+status_2 = 0;
+while status_2 < 95
+    pause(2);
+    status_1=g2s('-statusOnly',jobid_1);
+    status_2=g2s('-statusOnly',jobid_2);
+    fprintf('Status jobs 1 & 2:   %s %s\n', status_1, status_2);
+end
+
+% retrieve the simulation results from the server using the
+%"-waitAndDownload" flag. If the simulation would not be ready yet this
+%call would wait for it to be ready
+sim1=g2s('-waitAndDownload',jobid_1);
+sim2=g2s('-waitAndDownload',jobid_2);
+
+% display results
+sgtitle('Unconditional asynchronous simulation');
+subplot(1,3,1);
+imshow(ti);
+title('Training image');
+subplot(1,3,2);
+imshow(sim1);
+title('Simulation 1');
+subplot(1,3,3);
+imshow(sim2);
+title('Simulation 2');
+
+
+
+
+
+ +

+Publication

+ +

Gravey, M., & Mariethoz, G. (2020). QuickSampling v1.0: a robust and simplified pixel-based multiple-point simulation approach. Geoscientific Model Development, 13(6), 2611–2630. https://doi.org/10.5194/gmd-13-2611-2020

+ +

+Benchmarking

+ +

This code CAN be used for benchmarking (and I invite you to do so 😉), the code needs to run natively on macOS or on Linux using the Intel Compiler with MKL library. The version needs to be reported, and the time needs to be the time reported by the algorithm (that is the true execution time without taking into account interfaces overhead).

+ +

When benchmarking, the code should NOT be used inside a Virtual Machine or through WSL on Windows 10+.

+ +

+Advanced

+ +

This page provides some additional information on how to do common tasks. It also serves as personal note to myself 😁

+ +

+Multiple realization

+ +

A question that is frequently asked is how to do multiple realizations. Currently there are three different ways to do it, each one of them has pros and cons.

+ +

The lazy solution

+ +

The simplest solution is to do a for-loop over the realizations. However, in each step the algorithm needs to wait for the data to load, and this creates an overhead

+ +
sims1=numpy.empty((250,250,numberOfSimulation));
+for i in range(numberOfSimulation):
+  sims1[:,:,i],*_=g2s('-sa',computationServer,'-a','qs','-ti',ti,'-di',numpy.zeros((250,250))*numpy.nan,'-dt',numpy.ones((1,)),'-k',1.2,'-n',50,'-j',0.5,'-s',100+i);
+
+ +

For-loop without overhead

+ +

By using the G2S submission queue, it’s possible to remove most of the overhead. This is the most versatile solution and it is recommended over the first solution, especially in case the computations are run on another machine. Furthermore, in this solution the parameters can be changed for each realization.

+ +
ds=numpy.empty((numberOfSimulation,), dtype='long');
+for i in range(numberOfSimulation):
+  ids[i]=g2s('-sa',computationServer,'-a','qs','-ti',ti,'-di',numpy.zeros((250,250))*numpy.nan,'-dt',numpy.ones((1,)),'-k',1.2,'-n',50,'-j',0.5,'-s',100+i,'-submitOnly');
+
+sims2=numpy.empty((250,250,numberOfSimulation));
+for i in range(numberOfSimulation):
+  sims2[:,:,i],*_=g2s('-sa',computationServer,'-waitAndDownload',ids[i]);
+
+ +

Overdimensioning of the destination image

+ +

This is the third solution to get multiple simulations at once. Although this solution looks easier, it has more limitations (e.g., being limited same size, same parameters, etc.), and therefore it is ⚠️ not guaranteed to stay functional in the future. This last solution should only be considered in case of extremely parallelized simulations (number of threads >50) and/or extremely small simulations (less than 1e4 pixels per simulation)

+ +
sims3,*_=g2s('-sa',computationServer,'-a','qs','-ti',ti,'-di',numpy.zeros((numberOfSimulation,250,250))*numpy.nan,'-dt',numpy.ones((1,)),'-k',1.2,'-n',50,'-j',0.5);
+
+ +

+How to do a simulation by segment

+ +

Although QS tends to reduce issues related to non-stationarity, it won’t remove them completely. Therefore in cases with high non-stationarity, the challenge is to respect each zone separately. Here we assume that we have different training images for each specific zone.

+ +

Using a secondary variable

+ +

The first solution for doing a simulation by segment is to add a secondary variable with the information of non-stationarity. In this case the setting of the algorithm has to be identical for both training images.

+ +
ti1=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/bangladesh.tiff');
+ti2=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/strebelle.tiff');
+
+dt=[0];
+N=300;
+
+ti1_bis=cat(3,ti1,zeros(size(ti1)));
+ti2_bis=cat(3,ti2,ones(size(ti2)));
+
+localKernel=cat(3,kernel,padarray(15,25*[1,1]));
+% localKernel=cat(3,kernel,kernel);
+
+sim=g2s('-a','qs','-ti',ti1_bis,ti2_bis,'-di',cat(3,nan(size(tiSelection)),tiSelection),'-dt',[0,1],'-n',50,'-k',1.5,'-j',0.5,'-ki',localKernel);
+imshow(medfilt2(sim(:,:,1)))
+drawnow;
+pause(5)
+
+ +

Using training image indices

+

The second solution for doing a simulation by segment is to use a training image index map. This requires that each training image represents a stationary subdomain. Also in this case the setting of the algorithm needs to be identical between training images.

+ +

+ti1=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/bangladesh.tiff');
+ti2=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/strebelle.tiff');
+
+dt=[0];
+N=300;
+
+sim=g2s('-a','qs','-ti',ti1,ti2,'-di',nan(size(tiSelection)),'-dt',dt,'-n',50,'-k',1.5,'-j',0.5,'-ki',kernel,'-ii',tiSelection);
+imshow(medfilt2(sim))
+pause(5)
+
+ +

The optimal solution

+ +

Using the -ni and -kii … +TODO!!

+ +

Simulating each subdomain sequentially

+

The last solution for doing a simulation by segment is to do simulations per subdomain. This allows for changing the settings between each subdomain. However each subdomain is simulated sequentially and therefore can be at the origin of some artifacts, regarding the order of simulations.

+ +
ti1=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/bangladesh.tiff');
+ti2=imread('https://raw.githubusercontent.com/GAIA-UNIL/TrainingImagesTIFF/master/strebelle.tiff');
+
+dt=[0];
+N=300;
+
+path=reshape(randperm(numel(tiSelection)),size(tiSelection));
+p1=path;
+p1(tiSelection==0)=-inf;
+p2=path;
+p2(tiSelection==1)=-inf;
+sim=g2s('-a','qs','-ti',ti1,'-di',nan(size(tiSelection)),'-dt',dt,'-n',50,'-k',1.5,'-j',0.5,'-ki',kernel,'-sp',p1);
+sim=g2s('-a','qs','-ti',ti2,'-di',sim,'-dt',dt,'-n',50,'-k',1.5,'-j',0.5,'-ki',kernel,'-sp',p2);
+imshow(medfilt2(sim))
+pause(5)
+
+ + +
+
+
+ + + \ No newline at end of file diff --git a/assets/css/g2s.css b/assets/css/g2s.css new file mode 100644 index 0000000..39fd4df --- /dev/null +++ b/assets/css/g2s.css @@ -0,0 +1,366 @@ +:root { + --mainContentWidth: 690px; + --rightMenuWidth:200px; + --leftMenuWidth: min( calc( 100vw - var(--mainContentWidth) - 116px), 325px); + --titleColor: #474747; + --bgColor: #fafafa; + --code-color: #222; + --code-bg-color: hsla(204,63%,50%,0.05); + --table-color: #424242; + --table-title-color: #292929; + --how2site-bg: #e9e9e9; + --highlight-bg-color: #f8f8f8; + --highlight-in-bg-color: #F2F8FB; + --light-hover-gray:#ddd; + --light-gray:#ccc; + --very-light-gray:#f1f1f1; + --color: hsl(0deg 0% 19%); +} + +@media (prefers-color-scheme: dark) { + + :root{ + --titleColor: #b8b8b8; + --bgColor: hsl(0deg 0% 7%); + --color: hsl(0deg 0% 81%); + --code-color: #ddd; + --table-color: hsl(0, 0%, 85%); + --table-title-color: hsl(0, 0%, 95%); + --how2site-bg: hsl(0, 0%, 20%); + --highlight-bg-color: black; + --highlight-in-bg-color: hsl(200deg, 4%, 5%); + --code-bg-color: hsla(204,63%,50%,0.1); + --light-hover-gray:#666; + --light-gray:#444; + --very-light-gray:#0e0e0e; + } + + code{ + filter: invert(1) hue-rotate(180deg); + background-color: hsl(204 63% 30% / 25%);; + } +} + +body { + background: var(--bgColor); + color: var(--color); + font-size: 18px; + overflow-x: hidden; +} + +.inner { + width: min( calc( var(--mainContentWidth) + 45px), calc( 100% + 45px) ); +} + +#main-content h1, #main-content h2, #main-content h3, #main-content h4, #main-content h5, #main-content h6 { + color: var(--titleColor); +} + +@media only screen and (max-width: 1167px) { + :root { + --leftMenuWidth: auto; + } +} + +@media only screen and (min-width: 1168px) { + + .inner{ + width: calc( var(--leftMenuWidth) + var(--mainContentWidth) + 100px); + } +} + +header { + padding-left: 20px; +} + +header h1 { + width: 700px; +} + +header h2 { + width: 690px; +} + +.sideMenu a{ + color: var(--titleColor); + font-family: 'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif; + font-size: 25px +} + +nav.sideMenuBar ul{ + margin-bottom:0px; +} + +nav.sideMenu ul *{ + list-style-type: none; +} + +nav.sideMenu ul > li:before { + padding-right: 0.3em; + margin-left: -0.9em; + color: #9ddcff; + content: "/" +} + +nav.sideMenu ul ul > li:before { + padding-right: 0.3em; + margin-left: -1.5em; + content: "//"; + color: #9ddcff; +} + +nav.sideMenu ul ul ul > li:before { + padding-right: 0.3em; + margin-left: -2em; + content: "///"; + color: #9ddcff; +} + +nav.sideMenu ul ul ul ul > li:before { + padding-right: 0.3em; + margin-left: -2em; + content: "●"; + color: #9ddcff; +} + +nav.sideMenu ul ul ul ul ul> li:before { + padding-right: 0.3em; + margin-left: -2em; + content: "●/"; + color: #9ddcff; +} + +nav.sideMenu ul ul ul ul a { + font-size: 20px; +} + + +aside#menuSidebar { + position: sticky; + top: 0px; + float: left; + width: var(--leftMenuWidth); +/* min-height: 504px;*/ +padding-left: 20px; +line-height: 1.3; +} +aside#menuSidebar { + font-weight: bold; +} + +#main-content { + float: left; + width: var(--mainContentWidth); + margin: 0 0 30px 45px; + +} + +#content-wrapper{ + z-index: 1; + position: relative; + background: var(--bgColor); + min-height: calc( 100vh - 340px - 71.5px); +} + +footer { + margin: 0; + position: sticky; + bottom: 0; + left: 0; + width: 100%; + background: #2e7bcf url(../images/header-bg.jpg) 0 0 repeat-x; + display: inline-grid; + place-items: center; + padding: 10px 0; +} + +footer a{ + color: white; + font-weight: bold; +} +footer { + color: #d4d4d4; +} + +footer p{ + margin: 0; +} + +.githubButton{ + position: absolute; + top: 0; + right: 0; + display: flex; + height: 270px; + justify-content: space-between; + flex-direction: column; +} + +header .githubButton a.button{ + position: static; +} + + + +@media only screen and (max-width: 1167px) +{ + .githubButton { + position: relative; + display: flex; + height: 40px; + margin: 15px 0; + width: 100%; + justify-content: space-between; + flex-direction: row; + } +} + +@media only screen and (max-width: 767px){ + .githubButton .download{ + display: none; + } +} + + +header a.button.download { + background: transparent url(../images/download-button.png) 0 0 no-repeat; +} + +.tab { + display: inline-block; + overflow: hidden; + border: 1px solid var(--light-gray); + background-color: var(--very-light-gray); +} + +.tab button { + background-color: inherit; + float: left; + border: none; + outline: none; + cursor: pointer; + padding: 5px 16px; + transition: 0.3s; + font-size: 17px; +} + +.tab button img{ + height: 30px; +} + +.tab button:hover { + background-color: var(--light-hover-gray); +} + +.tab button.active { + background-color: var(--light-gray); +} + +.tabcontent { + display: none; + padding: 6px 12px; + border: 1px solid var(--light-gray); + border-top: none; +} + +.tab.code{ + margin: 0 0 -20px 0; + border-radius: 10px 20px 0 0; +} + +.tab.code button { + padding: 6px 8px 0px 8px; +} + +.tab.code button img{ + height: 20px; +} + +.langcontent.hideClass +{ + display: none; +} + +.highlight{ + background-color: var(--code-bg-color); +} + +pre code{ + background-color: transparent; +} + +pre{ + position: relative; +} + +span.copy{ + cursor: pointer; + position: absolute; + display: block; + right: 5px; + font-size: 30px; + color: var(--color); +} + +@media only screen and (max-width: 767px){ + span.copy{ + right: 45px; + } +} + +nav.sideMenu ul, ol, dl { + margin-bottom: 5px; +} + +tr td{ + font-weight: normal; +} + +tr td:first-child{ + width:75px; + text-align: center; + white-space: nowrap; +} + +tr td:nth-child(2){ + text-align: justify; + padding: 3px 10px ; +} + +th{ + font-weight: 900; + font-style: italic; +} + +@media only screen and (max-width: 1167px) +{ + aside#menuSidebar { + position: relative; + } +} + +@media only screen and (max-width: 767px){ + #main-content{ + width:calc(100vw - 4px) !important; + margin: 2px; + } + + html{ + overflow-x: hidden; + } + + header h2 { + width: calc( 100vw - 40px); + } + + header h1{ + width: calc( 100vw - 40px); + } +} + +red{ + color:red; +} + + + diff --git a/assets/css/print.css b/assets/css/print.css new file mode 100644 index 0000000..c32f17d --- /dev/null +++ b/assets/css/print.css @@ -0,0 +1 @@ +html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{padding:0;margin:0;font:inherit;font-size:100%;vertical-align:baseline;border:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-spacing:0;border-collapse:collapse}body{font-family:'Helvetica Neue', Helvetica, Arial, serif;font-size:13px;line-height:1.5;color:#000}a{font-weight:bold;color:#d5000d}header{padding-top:35px;padding-bottom:10px}header h1{font-size:48px;font-weight:bold;line-height:1.2;color:#303030;letter-spacing:-1px}header h2{font-size:24px;font-weight:normal;line-height:1.3;color:#aaa;letter-spacing:-1px}#downloads{display:none}#main_content{padding-top:20px}code,pre{margin-bottom:30px;font-family:Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal;font-size:12px;color:#222}code{padding:0 3px}pre{padding:20px;overflow:auto;border:solid 1px #ddd}pre code{padding:0}ul,ol,dl{margin-bottom:20px}table{width:100%;border:1px solid #ebebeb}th{font-weight:500}td{font-weight:300;text-align:center;border:1px solid #ebebeb}form{padding:20px;background:#f2f2f2}h1{font-size:2.8em}h2{margin-bottom:8px;font-size:22px;font-weight:bold;color:#303030}h3{margin-bottom:8px;font-size:18px;font-weight:bold;color:#d5000d}h4{font-size:16px;font-weight:bold;color:#303030}h5{font-size:1em;color:#303030}h6{font-size:.8em;color:#303030}p{margin-bottom:20px;font-weight:300}a{text-decoration:none}p a{font-weight:400}blockquote{padding:0 0 0 30px;margin-bottom:20px;font-size:1.6em;border-left:10px solid #e9e9e9}ul li{padding-left:20px;list-style-position:inside;list-style:disc}ol li{padding-left:3px;list-style-position:inside;list-style:decimal}dl dd{font-style:italic;font-weight:100}footer{padding-top:20px;padding-bottom:30px;margin-top:40px;font-size:13px;color:#aaa}footer a{color:#666}.clearfix:after{display:block;height:0;clear:both;visibility:hidden;content:'.'}.clearfix{display:inline-block}* html .clearfix{height:1%}.clearfix{display:block} diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 0000000..64d835e --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */@import url("https://fonts.googleapis.com/css?family=Architects+Daughter");html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}.highlight table td{padding:5px}.highlight table pre{margin:0}.highlight .cm{color:#999988;font-style:italic}.highlight .cp{color:#999999;font-weight:bold}.highlight .c1{color:#999988;font-style:italic}.highlight .cs{color:#999999;font-weight:bold;font-style:italic}.highlight .c,.highlight .cd{color:#999988;font-style:italic}.highlight .err{color:#a61717;background-color:#e3d2d2}.highlight .gd{color:#000000;background-color:#ffdddd}.highlight .ge{color:#000000;font-style:italic}.highlight .gr{color:#aa0000}.highlight .gh{color:#999999}.highlight .gi{color:#000000;background-color:#ddffdd}.highlight .go{color:#888888}.highlight .gp{color:#555555}.highlight .gs{font-weight:bold}.highlight .gu{color:#aaaaaa}.highlight .gt{color:#aa0000}.highlight .kc{color:#000000;font-weight:bold}.highlight .kd{color:#000000;font-weight:bold}.highlight .kn{color:#000000;font-weight:bold}.highlight .kp{color:#000000;font-weight:bold}.highlight .kr{color:#000000;font-weight:bold}.highlight .kt{color:#445588;font-weight:bold}.highlight .k,.highlight .kv{color:#000000;font-weight:bold}.highlight .mf{color:#009999}.highlight .mh{color:#009999}.highlight .il{color:#009999}.highlight .mi{color:#009999}.highlight .mo{color:#009999}.highlight .m,.highlight .mb,.highlight .mx{color:#009999}.highlight .sb{color:#d14}.highlight .sc{color:#d14}.highlight .sd{color:#d14}.highlight .s2{color:#d14}.highlight .se{color:#d14}.highlight .sh{color:#d14}.highlight .si{color:#d14}.highlight .sx{color:#d14}.highlight .sr{color:#009926}.highlight .s1{color:#d14}.highlight .ss{color:#990073}.highlight .s{color:#d14}.highlight .na{color:#008080}.highlight .bp{color:#999999}.highlight .nb{color:#0086B3}.highlight .nc{color:#445588;font-weight:bold}.highlight .no{color:#008080}.highlight .nd{color:#3c5d5d;font-weight:bold}.highlight .ni{color:#800080}.highlight .ne{color:#990000;font-weight:bold}.highlight .nf{color:#990000;font-weight:bold}.highlight .nl{color:#990000;font-weight:bold}.highlight .nn{color:#555555}.highlight .nt{color:#000080}.highlight .vc{color:#008080}.highlight .vg{color:#008080}.highlight .vi{color:#008080}.highlight .nv{color:#008080}.highlight .ow{color:#000000;font-weight:bold}.highlight .o{color:#000000;font-weight:bold}.highlight .w{color:#bbbbbb}.highlight{background-color:#f8f8f8}body{font-family:'Helvetica Neue', Helvetica, Arial, serif;font-size:15px;font-weight:400;line-height:1.5;color:#666;background:#fafafa url(../images/body-bg.jpg) 0 0 repeat}p{margin-top:0}a{color:#2879d0}a:hover{color:#2268b2}header{padding-top:40px;padding-bottom:40px;font-family:'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif;background:#2e7bcf url(../images/header-bg.jpg) 0 0 repeat-x;border-bottom:solid 1px #275da1}header h1{width:540px;margin-top:0;margin-bottom:0.2em;font-size:72px;font-weight:normal;line-height:1;color:#fff;letter-spacing:-1px}header h2{width:540px;margin-top:0;margin-bottom:0;font-size:26px;font-weight:normal;line-height:1.3;color:#9ddcff;letter-spacing:0}.inner{position:relative;width:940px;margin:0 auto}#content-wrapper{padding-top:30px;border-top:solid 1px #fff}#main-content{float:left;width:690px}#main-content img{max-width:100%}aside#sidebar{float:right;width:200px;min-height:504px;padding-left:20px;font-size:12px;line-height:1.3;background:transparent url(../images/sidebar-bg.jpg) 0 0 no-repeat}aside#sidebar p.repo-owner,aside#sidebar p.repo-owner a{font-weight:bold}#downloads{margin-bottom:40px}a.button{width:134px;height:58px;padding-top:22px;padding-left:68px;font-family:'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif;font-size:23px;line-height:1.2;color:#fff}a.button small{display:block;font-size:11px}header a.button{position:absolute;top:0;right:0;background:transparent url(../images/github-button.png) 0 0 no-repeat}aside a.button{display:block;width:138px;padding-left:64px;margin-bottom:20px;font-size:21px;background:transparent url(../images/download-button.png) 0 0 no-repeat}code,pre{margin-bottom:30px;font-family:Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;font-size:13px;color:#222}code{padding:0 3px;background-color:#f2f8fc;border:solid 1px #dbe7f3}pre{padding:20px;overflow:auto;text-shadow:none;background:#fff;border:solid 1px #f2f2f2}pre code{padding:0;color:#2879d0;background-color:#fff;border:none}ul,ol,dl{margin-bottom:20px}hr{height:0;margin-top:1em;margin-bottom:1em;border:0;border-top:solid 1px #ddd}table{width:100%;border:1px solid #ebebeb}th{font-weight:500}td{font-weight:300;text-align:center;border:1px solid #ebebeb}form{padding:20px;background:#f2f2f2}#main-content h1{margin-top:0;margin-bottom:0;font-family:'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif;font-size:2.8em;font-weight:normal;color:#474747;text-indent:6px;letter-spacing:-1px}#main-content h1:before{padding-right:0.3em;margin-left:-0.9em;color:#9ddcff;content:"/"}#main-content h2{margin-bottom:8px;font-family:'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif;font-size:22px;font-weight:bold;color:#474747;text-indent:4px}#main-content h2:before{padding-right:0.3em;margin-left:-1.5em;content:"//";color:#9ddcff}#main-content h3{margin-top:24px;margin-bottom:8px;font-family:'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif;font-size:18px;font-weight:bold;color:#474747;text-indent:3px}#main-content h3:before{padding-right:0.3em;margin-left:-2em;content:"///";color:#9ddcff}#main-content h4{margin-bottom:8px;font-family:'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif;font-size:15px;font-weight:bold;color:#474747;text-indent:3px}h4:before{padding-right:0.3em;margin-left:-2.8em;content:"////";color:#9ddcff}#main-content h5{margin-bottom:8px;font-family:'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif;font-size:14px;color:#474747;text-indent:3px}h5:before{padding-right:0.3em;margin-left:-3.2em;content:"/////";color:#9ddcff}#main-content h6{margin-bottom:8px;font-family:'Architects Daughter', 'Helvetica Neue', Helvetica, Arial, serif;font-size:.8em;color:#474747;text-indent:3px}h6:before{padding-right:0.3em;margin-left:-3.7em;content:"//////";color:#9ddcff}p{margin-bottom:20px}a{text-decoration:none}p a{font-weight:400}blockquote{padding:0 0 0 30px;margin-bottom:20px;font-size:15px;border-left:10px solid #e9e9e9}ul{list-style-position:inside;list-style:disc;padding-left:20px}ol{list-style-position:inside;list-style:decimal;padding-left:20px}dl dd{font-style:italic;font-weight:100}footer{padding-top:20px;padding-bottom:30px;margin-top:40px;font-size:13px;color:#aaa}footer a{color:#666}footer a:hover{color:#444}.clearfix:after{display:block;height:0;clear:both;visibility:hidden;content:'.'}.clearfix{display:inline-block}* html .clearfix{height:1%}.clearfix{display:block}@media only screen and (min-width: 768px) and (max-width: 959px){.inner{width:740px}header h1,header h2{width:340px}header h1{font-size:60px}header h2{font-size:30px}#main-content{width:490px}#main-content h1:before,#main-content h2:before,#main-content h3:before,#main-content h4:before,#main-content h5:before,#main-content h6:before{padding-right:0;margin-left:0;content:none}}@media only screen and (max-width: 767px){.inner{width:93%}header{padding:20px 0}header .inner{position:relative}header h1,header h2{width:100%}header h1{font-size:48px}header h2{font-size:24px}header a.button{position:relative;display:inline-block;width:auto;height:auto;padding:5px 10px;margin-top:15px;font-size:13px;line-height:1;color:#2879d0;text-align:center;background-color:#9ddcff;background-image:none;border-radius:5px;-moz-border-radius:5px;-webkit-border-radius:5px}header a.button small{display:inline;font-size:13px}#main-content,aside#sidebar{float:none;width:100% !important}aside#sidebar{min-height:0;padding:20px 0;margin-top:20px;background-image:none;border-top:solid 1px #ddd}aside#sidebar a.button{display:none}#main-content h1:before,#main-content h2:before,#main-content h3:before,#main-content h4:before,#main-content h5:before,#main-content h6:before{padding-right:0;margin-left:0;content:none}} diff --git a/assets/images/Matlab.png b/assets/images/Matlab.png new file mode 100644 index 0000000..b5a5435 Binary files /dev/null and b/assets/images/Matlab.png differ diff --git a/assets/images/Python.svg b/assets/images/Python.svg new file mode 100644 index 0000000..366f52f --- /dev/null +++ b/assets/images/Python.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/assets/images/Rlogo.svg b/assets/images/Rlogo.svg new file mode 100644 index 0000000..78281f7 --- /dev/null +++ b/assets/images/Rlogo.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/assets/images/Windows.png b/assets/images/Windows.png new file mode 100644 index 0000000..37ebe8d Binary files /dev/null and b/assets/images/Windows.png differ diff --git a/assets/images/apple.png b/assets/images/apple.png new file mode 100644 index 0000000..de51016 Binary files /dev/null and b/assets/images/apple.png differ diff --git a/assets/images/body-bg.jpg b/assets/images/body-bg.jpg new file mode 100644 index 0000000..719fb88 Binary files /dev/null and b/assets/images/body-bg.jpg differ diff --git a/assets/images/cloudGear.svg b/assets/images/cloudGear.svg new file mode 100644 index 0000000..928456c --- /dev/null +++ b/assets/images/cloudGear.svg @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/content_copy.svg b/assets/images/content_copy.svg new file mode 100644 index 0000000..c5f4a8d --- /dev/null +++ b/assets/images/content_copy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/download-button.png b/assets/images/download-button.png new file mode 100644 index 0000000..c5ffb3a Binary files /dev/null and b/assets/images/download-button.png differ diff --git a/assets/images/github-button.png b/assets/images/github-button.png new file mode 100644 index 0000000..cd41580 Binary files /dev/null and b/assets/images/github-button.png differ diff --git a/assets/images/header-bg.jpg b/assets/images/header-bg.jpg new file mode 100644 index 0000000..d16497a Binary files /dev/null and b/assets/images/header-bg.jpg differ diff --git a/assets/images/highlight-bg.jpg b/assets/images/highlight-bg.jpg new file mode 100644 index 0000000..355e089 Binary files /dev/null and b/assets/images/highlight-bg.jpg differ diff --git a/assets/images/linux.png b/assets/images/linux.png new file mode 100644 index 0000000..f0e2895 Binary files /dev/null and b/assets/images/linux.png differ diff --git a/assets/images/sidebar-bg.jpg b/assets/images/sidebar-bg.jpg new file mode 100644 index 0000000..536ead9 Binary files /dev/null and b/assets/images/sidebar-bg.jpg differ diff --git a/assets/js/codeblock.js b/assets/js/codeblock.js new file mode 100644 index 0000000..7df33b1 --- /dev/null +++ b/assets/js/codeblock.js @@ -0,0 +1,16 @@ +document.addEventListener('DOMContentLoaded', function() { + var codeBlocks = document.querySelectorAll('pre.highlight'); + + codeBlocks.forEach(function (codeBlock) { + var copyButton = document.createElement('span'); + copyButton.classList.add("material-symbols-outlined","copy"); + copyButton.innerText = 'content_copy'; + + codeBlock.parentElement.prepend(copyButton); + + copyButton.addEventListener('click', function () { + var code = codeBlock.querySelector('code').innerText.trim(); + window.navigator.clipboard.writeText(code); + }); + }); +}); \ No newline at end of file diff --git a/assets/js/tabManager.js b/assets/js/tabManager.js new file mode 100644 index 0000000..097797f --- /dev/null +++ b/assets/js/tabManager.js @@ -0,0 +1,26 @@ +function openTab(evt, tabName, type) { + var i, tabcontent, tablinks, activeTabcontent, allButton; + tabcontent = document.getElementsByClassName("langcontent "+type); + for (i = 0; i < tabcontent.length; i++) { + tabcontent[i].classList.add("hideClass"); + } + tablinks = document.getElementsByClassName("tablinks"); + for (i = 0; i < tablinks.length; i++) { + tablinks[i].classList.remove("active"); + } + console.log(tabName) + activeTabcontent=document.getElementsByClassName("langcontent "+tabName) + + for (i = 0; i < activeTabcontent.length; i++) { + activeTabcontent[i].classList.remove("hideClass"); + } + allButton=document.getElementsByClassName("tablinks "+tabName); + console.log(allButton) + for (i = 0; i < activeTabcontent.length; i++) { + allButton[i].classList.add("active"); + } +} + +document.addEventListener('DOMContentLoaded', function() { + openTab(null, "python", "code interface"); +}); diff --git a/autoqs.html b/autoqs.html new file mode 100644 index 0000000..3675c2a --- /dev/null +++ b/autoqs.html @@ -0,0 +1,11 @@ + + + + Redirecting… + + + + +

Redirecting…

+ Click here if you are not redirected. + diff --git a/briefOverview.html b/briefOverview.html new file mode 100644 index 0000000..68d0c83 --- /dev/null +++ b/briefOverview.html @@ -0,0 +1,394 @@ + + + + + + + + + + + + + + + + + + + + +Brief overview | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

Brief overview

+ +

The GeoStatistical Server (G2S) is a framework that allows you to use state-of-the-art Multiple Point Statistics (MPS) algorithms to run stochastic simulations.

+ +

G2S is designed to run simulations in a generic way, independently of the code used or language it is written in. For example, it enables you to run a C/C++ simulation code using Python, or Python using MATLAB (or any other combination).

+ +

Currently, the framework is provided with:

+ +
    +
  • QuickSampling (QS) (aka. Quantile Sampling) is a general-purpose pixel-based MPS algorithm that is designed to be robust, efficient, and run in constant time. QS was designed to adapt to your problem; it can be used to do (un)conditional simulation, gap filling, or even downscaling, using continuous or categorical variables or a combination of both. The code was developed without restrictions regarding the dimensionality of the data (e.g. 1D, 2D, 3D, nD). +
      +
    • A journal article published in Geoscientific Model Development describes the method here.
    • +
    +
  • +
  • Narrow Distribution Selection (NDS) is an algorithm specifically targeted to simulate spectrally enhanced remote-sensed imagery. It requires an external variable (for example, a grayscale image) to control the simulation (of colors). + +
  • +
+ +

The framework can be easily extended to handle most codes that use gridded data. Currently, any compiled code or Python code can be handled.

+ +

For a hands-on introduction to MPS (PPT slides, Colab Notebook & recorded tutorial), follow this link.

+ +
+
+
+ + + \ No newline at end of file diff --git a/feed.xml b/feed.xml new file mode 100644 index 0000000..cefcbe1 --- /dev/null +++ b/feed.xml @@ -0,0 +1 @@ +Jekyll2023-10-03T12:14:43+00:00https://gaia-unil.github.io//G2S/feed.xmlG2S: The GeoStatistical ServerA free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..adfc3d8 --- /dev/null +++ b/index.html @@ -0,0 +1,11 @@ + + + + Redirecting… + + + + +

Redirecting…

+ Click here if you are not redirected. + diff --git a/installation.html b/installation.html new file mode 100644 index 0000000..75f947b --- /dev/null +++ b/installation.html @@ -0,0 +1,398 @@ + + + + + + + + + + + + + + + + + + + + +Algorithms | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

To use the GeoStatistical Server (G2S), you need to install both the G2S server and an interface that matches your preferred programming language. The server handles the core functionality and computations, while the interface enables communication between your code and the server. Follow the steps below to install both components:

+ +
    +
  1. +

    Install the G2S server: The server is the backbone of the G2S framework, responsible for running the simulations. To install the G2S server, follow the instructions provided in the server installation guide.

    +
  2. +
  3. +

    Install the G2S interface: Choose the interface that corresponds to your preferred programming language (Python, MATLAB, or R). These interfaces are written in C++, ensuring seamless integration and performance. To install the appropriate G2S interface, refer to the instructions in the interface installation guide.

    +
  4. +
+ +

After completing the installation of both the G2S server and the corresponding interface, you can start running stochastic simulations using the G2S framework in your preferred programming language.

+ +

Explanation

+ +

The GeoStatistical Server (G2S) utilizes a server-interface architecture to provide a versatile, efficient, and user-friendly platform for running geostatistical simulations. This design choice offers several key advantages:

+ +
    +
  • +

    Language and code-independence: By decoupling the server and algorithm implementation (written in highly optimized C++) from the interface, G2S interface can work seamlessly with various programming languages, including Python, MATLAB, and R. Users can run simulations using their preferred language without worrying about compatibility issues.

    +
  • +
  • +

    Flexibility and extensibility: The server-interface architecture allows for easy integration of new algorithms and techniques as they become available. This modular design ensures that the framework can be updated and improved without disrupting existing workflows.

    +
  • +
  • +

    Scalability and performance: The algorithms are written in C++, a language known for its high performance and efficiency, ensuring that the simulations are executed quickly and reliably. Additionally, the server can be set up to handle multiple simultaneous requests and remotely, making it suitable for large-scale applications.

    +
  • +
+ +

The G2S framework supports Python, MATLAB, and R interfaces, ensuring seamless integration with popular scientific programming languages while maintaining the performance benefits of the underlying C++ implementation. A Python server interface (to implement algorithms in Python) is also available. While originally designed for prototyping, it allows for a quick conversion of existing workflows in G2S.

+ +
+
+
+ + + \ No newline at end of file diff --git a/installation/cluster.html b/installation/cluster.html new file mode 100644 index 0000000..6df691c --- /dev/null +++ b/installation/cluster.html @@ -0,0 +1,496 @@ + + + + + + + + + + + + + + + + + + + + +Server autostart | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

Server autostart

+ +

When running the server on a workstation, sometimes an automatic reboot may be needed (e.g., update, power cut, etc). To make matters worse, we may need to login to start again the server. In addition to machine reboots, sometimes servers can crash.

+ +

On Linux machines, it is possible to run the software in the background and launch it automatically at start-up. Here is the installation for Ubuntu, but it’s very simple to adapt it for other systems.

+ +

Many solutions exist with cron, etc., but my favorite one is with systemd

+ +
    +
  1. First follow the standard Linux installation.
  2. +
  3. Test if everything works correctly.
  4. +
  5. Create a new service, let’s call it G2S.service, to do so create a new file /etc/systemd/system/G2S.service
  6. +
  7. Paste the following code and it’s done: +
     [Unit]
    + Description=G2S service
    + After=network-online.target
    + StartLimitIntervalSec=0
    +
    + [Service]
    + Type=simple
    + Restart=always
    + RestartSec=1
    + User=tesla-k20c
    + # update {pathToTheServer} with the path where "./server" is located,
    + # intel-build or c++-build, regarding your choice 
    + WorkingDirectory={pathToTheServer}
    + # if you use the Intel version, you probably want to load the libraries
    + # like : /bin/bash -c "source /opt/Intel/parallel_studio_xe_2019/bin/psxevars.sh intel64; ./server -kod -age 864000"
    + ExecStart=/bin/bash -c "./server -kod -age 864000"
    + # -age 864000	==> keep the file for 10 days
    + # -kod		==> don't remove old files in case of reboot or crash
    +
    + [Install]
    + WantedBy=multi-user.target
    +
    +
  8. +
  9. Start the service with systemctl start G2S
  10. +
  11. Once everything works flawlessly, set it to start automatically at boot with systemctl enable G2S
  12. +
  13. Enjoy!
  14. +
+ +

Cluster

+ +

In this section, I will give you a brief overview of how to set up G2S on a cluster. In this mode, the computation is not distributed through the cluster, but runs on a single cluster node.

+ +

The installation on a cluster can be a quite difficult task. Please don’t hesitate to ask for help from the team that manages the cluster.

+ +

The installation really depends on what the cluster team allows you to do or not.

+ +

Installation of libraries

+ +

In the best-case scenario, fftw3 is installed in a non-standard path (you may not find two clusters that have the stuff at the same place. Why? To make your life harder, of course! 🤪). Potentially you can have the Intel compiler installed with all the libraries. Please refer to your cluster documentation for this.

+ +

Probably ZMQ is not already installed, and don’t expect that they will install it for you. Also, jsoncpp is most probably missing too. In order to make life a bit easier for you, I prepared a small script that downloads and compiles all of these libraries and even modifies the Makefile.

+ +
    +
  1. Log in to a computation node (or submit a task).
  2. +
  3. Execute the script in build/forClusters/compileExternalLibs.sh (I assume that the front and the computational nodes are from the same generation, in other cases you can run into some unsupported instruction issues).
  4. +
  5. Wait until it’s finished, take this time to pray 🙏 to the god of the clusters.
  6. +
+ +

Compilation of G2S

+ +

The previous script updates the Makefile automatically, so refer to the standard Linux installation. ⚠️ Be careful to compile in a computational node and not on the front node; otherwise, you can have lots of painful issues later.

+ +

Execute the G2S server

+ +

Take a deep breath and don’t give up; it’s almost finished!

+ +

Now the challenging part starts. It is highly dependent on how lucky you are and how much energy you want to spend to make it work. But keep this in mind, spending some time now can make you win a lot later.

+ +

Simple, ugly, and inefficient solution

+ +

You can use this solution if you don’t have a queuing system. You really don’t? Are you sure you are on a cluster?

+ +
    +
  1. You simply start the G2S server on a node.
  2. +
  3. Once it’s running, connect to the node using an ssh tunnel: ssh -L 8128:theNodeName:8128 clusterAddress, this will redirect your localhost to the computation node.
  4. +
  5. Then run any G2S computation you like on your own computer.
  6. +
  7. Once you have all your computation finished, shut down the server with the ‘-shutdown’ argument. +⚠️ Although this solution looks simple, in reality, it’s dangerous and relatively hard to use on a busy cluster. In fact, when you want to run the server, you will probably finish in the waiting queue. If you are paying for the computations, you would be charged even when it isn’t computing any simulation because the node is busy (waiting for jobs). And if you are not charged, you still use resources that other people may need. Furthermore, with this solution, it’s extremely difficult to distribute many jobs across all the clusters. +Using nodeParallel could be a (smoother) solution too, in particular for multiple node submission.
  8. +
+ +

The way to go

+ +

The goal here is to create a task for each simulation and to add it to the queue. Again each cluster is different, some use PBS (qsub), some use SLURM(sbatch, srun),… (ok, it’s not the place to debate about this). We need to convert each call to an algorithm that doesn’t starts the computation, but instead submits it in the queue.

+ +

⚠️ currently computation interruption does not work on some clusters (Ctrl+C as well as ‘-kill’). Therefore, you need to manage job interruptions with the submission queue system. I will try to fix this issue as soon as I can, however it’s not on my priority list now.

+ +
    +
  1. If the cluster uses PBS or SLURM, check the related file in the forClusters directory. If it uses another system, check one and adapt for your situation. I advise asking the cluster team to help you with this, and they are paid to do that. (please contact me only if they couldn’t find out how to make it work)
  2. +
  3. if needed, adapt configureCluster.sh
  4. +
  5. execute configureCluster.sh
  6. +
  7. Open a tunnel to the front node ssh -L 8128:clusterAddress:8128 clusterAddress
  8. +
  9. start the server ./server -kod -age 864000 (adjust the 864000 regarding how long the file needs to be stored on the cluster (here 10 days))
  10. +
  11. Submit the jobs + once all the jobs are submitted you can close the connection (it is possible that you run into trouble if you run many thousands of tasks at the same time, in that case keep the connection open)
  12. +
+ +

even better

+ +

If you are lucky you may be able to keep the server running all the time on the front node. Then ….

+ +

You can try to run server in demons -d, if it’s authorized. So you can always cut the connection even if you submit one million tasks at the same time.

+ +

Then… if you’re even luckier you can open a port on the front node (here 8128). Don’t hesitate to ask the support if they can do this favor for you. If you can, 1) invest in a good bottle of wine for the support department, 2) If you are that lucky you should play lottery!

+ +

So, once the port is open and the server are executed as a deamon, you can close all connections, and simply put the address of the front node in each call to g2s ‘-sa’,clusterAddress

+ +

How to efficiently use it

+ +

Once the server runs on the front node use ‘‑submitOnly’,’‑statusOnly’ and ‘‑waitAndDownload’ to manage your computations. The G2S server is coming with its own submission queue and dependency manager. Because the dependencies are unknown, each job runs sequentially by default. To over pass this limitation we can simply specify dependency as :’‑after’,0, so each job can start in parallel.

+ +

A standard job submission should look like id=g2s(… usualParameter,’‑statusOnly’,’‑after’,0). +and to get the final result sim=g2s(‘‑waitAndDownload’,id)

+ +

Using nodeParallel

+

NodeParallel (NP) allow to forward command from one node to another, in our context from the login node to some worker nodes (it require a shared file system). Therefore we can use NP to forward computation command to computation nodes without making a new task in the submission queue. This is particularly interesting when we have lots of short jobs (it allows removing the initialization for each task), or when we have significantly more jobs than the number of tasks that we are allowed to submit to the queue.

+ +

To use it simple download NP from its github page, follow the instruction to install and add it to the PATH (at least each time you want to use it :) ). Then adapt the compilation for use on cluster using ./configureCluster.sh NP available in the forClusters folder. This configuration is not compatible with a queue submission one, so if you plan to use both strategies in parallel you need to duplicate the G2S installation. Run the NP and G2S servers, both on the login node.

+ +
    +
  1. You can run NP in demon mode ./server -d
  2. +
  3. When running the G2S server, add the -maxCJ n flag, with n between the number and few(<4x) times the number of jobs you plan to run in parallel.
  4. +
  5. Start (and you can even finish) to submit G2S tasks. (Refer to the previous sections to communicate with the login node, ssh tunneling, open ports on the login node …). Don’t forget the ‘-after’,0 to allow parallel computations.
  6. +
  7. Finally, run workers by submitting tasks to the normal submission queue(or directly to the computation nodes ) using the np_client -sa $HOSTNAME -sac -w in the folder that contain the G2S server. With $HOSTNAME the name or IP of the login node.
  8. +
+ + +
+
+
+ + + \ No newline at end of file diff --git a/installation/cluster.md b/installation/cluster.md new file mode 100644 index 0000000..bda8f4f --- /dev/null +++ b/installation/cluster.md @@ -0,0 +1,119 @@ +# Server autostart + +When running the server on a workstation, sometimes an automatic reboot may be needed (e.g., update, power cut, etc). To make matters worse, we may need to login to start again the server. In addition to machine reboots, sometimes servers can crash. + +On Linux machines, it is possible to run the software in the background and launch it automatically at start-up. Here is the installation for Ubuntu, but it's very simple to adapt it for other systems. + +Many solutions exist with cron, etc., but my favorite one is with systemd + +1. First follow the standard Linux installation. +2. Test if everything works correctly. +3. Create a new service, let's call it G2S.service, to do so create a new file `/etc/systemd/system/G2S.service` +4. Paste the following code and it's done: +``` + [Unit] + Description=G2S service + After=network-online.target + StartLimitIntervalSec=0 + + [Service] + Type=simple + Restart=always + RestartSec=1 + User=tesla-k20c + # update {pathToTheServer} with the path where "./server" is located, + # intel-build or c++-build, regarding your choice + WorkingDirectory={pathToTheServer} + # if you use the Intel version, you probably want to load the libraries + # like : /bin/bash -c "source /opt/Intel/parallel_studio_xe_2019/bin/psxevars.sh intel64; ./server -kod -age 864000" + ExecStart=/bin/bash -c "./server -kod -age 864000" + # -age 864000 ==> keep the file for 10 days + # -kod ==> don't remove old files in case of reboot or crash + + [Install] + WantedBy=multi-user.target +``` +5. Start the service with `systemctl start G2S` +6. Once everything works flawlessly, set it to start automatically at boot with `systemctl enable G2S` +7. Enjoy! + +# Cluster + +In this section, I will give you a brief overview of how to set up G2S on a cluster. In this mode, the computation is not distributed through the cluster, but runs on a single cluster node. + +The installation on a cluster can be a quite difficult task. Please don't hesitate to ask for help from the team that manages the cluster. + +The installation really depends on what the cluster team allows you to do or not. + +## Installation of libraries + +In the best-case scenario, fftw3 is installed in a non-standard path (you may not find two clusters that have the stuff at the same place. Why? To make your life harder, of course! 🤪). Potentially you can have the Intel compiler installed with all the libraries. Please refer to your cluster documentation for this. + +Probably ZMQ is not already installed, and don't expect that they will install it for you. Also, jsoncpp is most probably missing too. In order to make life a bit easier for you, I prepared a small script that downloads and compiles all of these libraries and even modifies the Makefile. + +1. Log in to a computation node (or submit a task). +2. Execute the script in `build/forClusters/compileExternalLibs.sh` (I assume that the front and the computational nodes are from the same generation, in other cases you can run into some unsupported instruction issues). +3. Wait until it's finished, take this time to pray 🙏 to the god of the clusters. + +## Compilation of G2S + +The previous script updates the Makefile automatically, so refer to the standard Linux installation. ⚠️ Be careful to compile in a computational node and not on the front node; otherwise, you can have lots of painful issues later. + +## Execute the G2S server + +Take a deep breath and don't give up; it's almost finished! + +Now the challenging part starts. It is highly dependent on how lucky you are and how much energy you want to spend to make it work. But keep this in mind, spending some time now can make you win a lot later. + +### Simple, ugly, and inefficient solution + +You can use this solution if you don't have a queuing system. You really don't? Are you sure you are on a cluster? + +1. You simply start the G2S server on a node. +2. Once it's running, connect to the node using an ssh tunnel: `ssh -L 8128:theNodeName:8128 clusterAddress`, this will redirect your localhost to the computation node. +3. Then run any G2S computation you like on your own computer. +4. Once you have all your computation finished, shut down the server with the '-shutdown' argument. +⚠️ Although this solution looks simple, in reality, it's dangerous and relatively hard to use on a busy cluster. In fact, when you want to run the server, you will probably finish in the waiting queue. If you are paying for the computations, you would be charged even when it isn't computing any simulation because the node is busy (waiting for jobs). And if you are not charged, you still use resources that other people may need. Furthermore, with this solution, it's extremely difficult to distribute many jobs across all the clusters. +Using nodeParallel could be a (smoother) solution too, in particular for multiple node submission. + +### The way to go + +The goal here is to create a task for each simulation and to add it to the queue. Again each cluster is different, some use PBS (qsub), some use SLURM(sbatch, srun),... (ok, it's not the place to debate about this). We need to convert each call to an algorithm that doesn't starts the computation, but instead submits it in the queue. + +⚠️ currently computation interruption does not work on some clusters (Ctrl+C as well as '-kill'). Therefore, you need to manage job interruptions with the submission queue system. I will try to fix this issue as soon as I can, however it's not on my priority list now. + +1. If the cluster uses PBS or SLURM, check the related file in the forClusters directory. If it uses another system, check one and adapt for your situation. I advise asking the cluster team to help you with this, and they are paid to do that. (please contact me only if they couldn't find out how to make it work) +2. if needed, adapt configureCluster.sh +3. execute configureCluster.sh +4. Open a tunnel to the front node ssh -L 8128:clusterAddress:8128 clusterAddress +5. start the server ./server -kod -age 864000 (adjust the 864000 regarding how long the file needs to be stored on the cluster (here 10 days)) +6. Submit the jobs + once all the jobs are submitted you can close the connection (it is possible that you run into trouble if you run many thousands of tasks at the same time, in that case keep the connection open) + +### even better + +If you are lucky you may be able to keep the server running all the time on the front node. Then .... + +You can try to run server in demons -d, if it's authorized. So you can always cut the connection even if you submit one million tasks at the same time. + +Then... if you’re even luckier you can open a port on the front node (here 8128). Don't hesitate to ask the support if they can do this favor for you. If you can, 1) invest in a good bottle of wine for the support department, 2) If you are that lucky you should play lottery! + +So, once the port is open and the server are executed as a deamon, you can close all connections, and simply put the address of the front node in each call to g2s '-sa',clusterAddress + +## How to efficiently use it + +Once the server runs on the front node use '‑submitOnly','‑statusOnly' and '‑waitAndDownload' to manage your computations. The G2S server is coming with its own submission queue and dependency manager. Because the dependencies are unknown, each job runs sequentially by default. To over pass this limitation we can simply specify dependency as :'‑after',0, so each job can start in parallel. + +A standard job submission should look like id=g2s(... usualParameter,'‑statusOnly','‑after',0). +and to get the final result sim=g2s('‑waitAndDownload',id) + +## Using nodeParallel +NodeParallel (NP) allow to forward command from one node to another, in our context from the login node to some worker nodes (it require a shared file system). Therefore we can use NP to forward computation command to computation nodes without making a new task in the submission queue. This is particularly interesting when we have lots of short jobs (it allows removing the initialization for each task), or when we have significantly more jobs than the number of tasks that we are allowed to submit to the queue. + +To use it simple download NP from its github page, follow the instruction to install and add it to the PATH (at least each time you want to use it :) ). Then adapt the compilation for use on cluster using ./configureCluster.sh NP available in the forClusters folder. This configuration is not compatible with a queue submission one, so if you plan to use both strategies in parallel you need to duplicate the G2S installation. Run the NP and G2S servers, both on the login node. + +1. You can run NP in demon mode ./server -d +2. When running the G2S server, add the -maxCJ n flag, with n between the number and few(<4x) times the number of jobs you plan to run in parallel. +3. Start (and you can even finish) to submit G2S tasks. (Refer to the previous sections to communicate with the login node, ssh tunneling, open ports on the login node ...). Don't forget the '-after',0 to allow parallel computations. +4. Finally, run workers by submitting tasks to the normal submission queue(or directly to the computation nodes ) using the np_client -sa $HOSTNAME -sac -w in the folder that contain the G2S server. With $HOSTNAME the name or IP of the login node. + diff --git a/installation/interfaces.html b/installation/interfaces.html new file mode 100644 index 0000000..df8f484 --- /dev/null +++ b/installation/interfaces.html @@ -0,0 +1,485 @@ + + + + + + + + + + + + + + + + + + + + +Installation of interfaces | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

Installation of interfaces

+ + +
+

+ +

+
+ +
+ +

Python

+ +

Automatic installation

+ +

Simply use pip install G2S

+ +

Manual compilation

+ +
    +
  1. If needed Python and Numpy: sudo apt install python3-distutils python3-dev python3-numpy -y
  2. +
  3. (A C++ compiler with c++17 is required)
  4. +
  5. Go to build/python-build
  6. +
  7. Run python3 setup.py install --user
  8. +
+ +

Check proper interface installation

+ +

Simply run from g2s import g2s; g2s('--version')

+
+ +
+ +

MATLAB

+ +
+

+ +

+
+ +
+ +

Installation on Ubuntu

+ +
    +
  1. (A C++ compiler with c++17 is required)
  2. +
  3. Open MATLAB
  4. +
  5. Go to build/matlab-build
  6. +
  7. Run CompileG2S
  8. +
  9. Add compiled file in the MATLAB path
  10. +
+
+ +
+ +

Installation on macOS

+ +
    +
  1. Open MATLAB
  2. +
  3. Go to build/build-matlab
  4. +
  5. Run CompileG2S
  6. +
  7. Add compiled file in the MATLAB path
  8. +
+
+ +
+ +

Installation on Windows 10

+ +
Download precompiled interfaces
+ +
    +
  1. Download here.
  2. +
  3. Unzip and add the folder to MATLAB path.
  4. +
+ +
Manual compilation
+ +
    +
  1. (A C++ compiler with c++17 is required)
  2. +
  3. If needed, install python with the option to add it to the Path
  4. +
  5. Open MATLAB
  6. +
  7. Install a compiler with c++17, available here (2017 or later)
  8. +
  9. Go to build/build-matlab
  10. +
  11. Run CompileG2S
  12. +
  13. Add compiled file in the MATLAB path
  14. +
+
+ +
Check proper interface installation
+ +

Simply run g2s('--version')

+ +
+ +
+ +

R

+ +

TODO !

+ +
+ +
+
+
+ + + \ No newline at end of file diff --git a/installation/server.html b/installation/server.html new file mode 100644 index 0000000..4a3e638 --- /dev/null +++ b/installation/server.html @@ -0,0 +1,496 @@ + + + + + + + + + + + + + + + + + + + + +Installation of the server | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

Installation of the server

+ +
+

+ + + + +

+
+ +
+ +

Installation of the server on Ubuntu

+ +
    +
  1. Install linuxbrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. +
  3. Run brew install open-geocomputing/brew/g2s
  4. +
  5. Use the g2s command
  6. +
+ +
+ +
+ +

Installation of the server on macOS

+ +
    +
  1. Install homebrew if not already done /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. +
  3. Run brew install open-geocomputing/brew/g2s
  4. +
  5. Use the g2s command
  6. +
+ +
+ +
+ +

Installation of the server on Windows 10

+ +
    +
  1. Check that the latest updates of Windows are installed
  2. +
  3. Install WSL following these instructions, and select a Linux distribution (we recommend choosing Ubuntu for beginners).
  4. +
  5. Install linuxbrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  6. +
  7. Run brew install open-geocomputing/brew/g2s
  8. +
  9. Use the g2s command
  10. +
+
+ +
+ +

Installation of the server manually from source on Ubuntu

+ +

Automatic with GCC on Ubuntu

+ +
    +
  1. First clone the code from this GitHub: git clone https://github.com/GAIA-UNIL/G2S.git
  2. +
  3. Then run build/c++-build/install_needs_W_VM.sh
  4. +
+ +

Manual (including Intel C++ Compiler)

+ +
    +
  1. First clone the code from this GitHub: git clone https://github.com/GAIA-UNIL/G2S.git
  2. +
  3. Basics for compiling are needed (e.g. on Ubuntu: build-essential).
  4. +
  5. The following packages are required: ZMQ, JsonnCpp and zlib for G2S; fftw3 for QS and NDS.
  6. +
  7. To install them on Ubuntu: sudo apt install build-essential libzmq3-dev libjsoncpp-dev zlib1g-dev libfftw3-dev libcurl4-openssl-dev -y (libcurl4-openssl-dev is optional).
  8. +
  9. The C++ extension for ZMQ is required too, and can be installed via: wget "https://raw.githubusercontent.com/zeromq/cppzmq/master/zmq.hpp" -O ./include/zmq.hpp
  10. +
  11. Go to the build subfolder.
  12. +
  13. Run: make -j, if the Intel C++ compiler is installed, the adapted version will be compiled too. The Intel compiler can be downloaded freely in many cases: here. +To manually select between GCC or Intel compiler use make c++ -j or make intel -j, respectively.
  14. +
  15. Run: make install
  16. +
+ +
+ +
+ +

Installation of the server manually from source on macOS

+ + + +
    +
  1. First clone the code from this GitHub: git clone https://github.com/GAIA-UNIL/G2S.git
  2. +
  3. Install the package manager Homebrew (if not already done)
  4. +
  5. The following packages are required: ZMQ, JsonnCpp and zlib for G2S. fftw3 for QS and NDS.
  6. +
  7. To install them with Homebrew: brew install fftw zmq jsoncpp cppzmq curl Note: curl is optional.
  8. +
  9. Go to the build subfolder.
  10. +
  11. Run: make -j, if the Intel C++ compiler is installed the adapted version will be compiled too. The Intel compiler can be downloaded freely in many cases: here. Obviously, Intel compiler is only for Intel CPUs 😁. To manually select between GCC or Intel compiler use make c++ -j or make intel -j, respectively.
  12. +
  13. Run: make install
  14. +
+ +

using MacPort (now deprecated)

+ +
    +
  1. First clone the code from this GitHub: git clone https://github.com/GAIA-UNIL/G2S.git
  2. +
  3. Install the package manager MacPort (if not already done)
  4. +
  5. The following packages are required: ZMQ, JsonnCpp and zlib for G2S. fftw3 for QS and NDS.
  6. +
  7. To install them with macPort: sudo port install zmq-devel jsoncpp-devel zlib cppzmq-devel fftw-3 fftw-3-single curl Note: curl is optional.
  8. +
  9. Go to the build subfolder.
  10. +
  11. Run: make -j, if the Intel C++ compiler is installed the adapted version will be compiled too. The Intel compiler can be downloaded freely in many cases: here. +To manually select between GCC or Intel compiler use make c++ -j or make intel -j, respectively.
  12. +
  13. Run: make install
  14. +
+ +
+ +
+ +

Installation of the server manually from source on Windows 10

+ +
    +
  1. Check that the latest updates of Windows are installed
  2. +
  3. Install WSL following these instructions, and select a Linux distribution (we recommend choosing Ubuntu for beginners).
  4. +
  5. Clone the code from this GitHub repository: https://github.com/GAIA-UNIL/G2S.git (or download and unzip the zip-file on the top right of this page).
  6. +
  7. In Windows, go to the directory build/c++-build and run/double-click install.bat.
  8. +
+ +
+ +
+
+
+ + + \ No newline at end of file diff --git a/nds.html b/nds.html new file mode 100644 index 0000000..351d933 --- /dev/null +++ b/nds.html @@ -0,0 +1,11 @@ + + + + Redirecting… + + + + +

Redirecting…

+ Click here if you are not redirected. + diff --git a/qs.html b/qs.html new file mode 100644 index 0000000..500db63 --- /dev/null +++ b/qs.html @@ -0,0 +1,11 @@ + + + + Redirecting… + + + + +

Redirecting…

+ Click here if you are not redirected. + diff --git a/redirects.json b/redirects.json new file mode 100644 index 0000000..5dcbeba --- /dev/null +++ b/redirects.json @@ -0,0 +1 @@ +{"/autoqs":"https://gaia-unil.github.io//G2S/algorithms/AutoQS.html","/nds":"https://gaia-unil.github.io//G2S/algorithms/NarrowDistributionSelection.html","/qs":"https://gaia-unil.github.io//G2S/algorithms/QuickSampling.html","/":"https://gaia-unil.github.io//G2S/briefOverview.html"} \ No newline at end of file diff --git a/runTheServer.html b/runTheServer.html new file mode 100644 index 0000000..6824492 --- /dev/null +++ b/runTheServer.html @@ -0,0 +1,434 @@ + + + + + + + + + + + + + + + + + + + + +Run the server | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

Run the server

+

Simply run g2s server to launch the server, optionally accompanied by any of the below settings. Alternatively, run g2s enable to launch the server and make sure it relaunches at start-up when you reboot your machine (and run g2s disable to disable this service again). +If you did not install g2s through linuxbrew but chose the manual installation from source instead, launch the server by running ./server from within the G2S/build/c++-build (or G2S/build/intel-build for the intel version).

+ +

ⓘ The server generates logs- and data-files in subfolders /tmp/G2S/logs and /tmp/G2S/data that are saved for debug purposes. They are currently automatically removed at the reboot of the computer, at the launch of the server or after one day. This parameterization can be changed with -kod and -age.

+ +

Parameterization

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FlagDescription
-dRun as daemon
-To nShutdown the server if there is no activity after n seconds, 0 for ∞ (default: 0)
-pSelect a specific port for the server (default: 8128)
-kodKeep old data, if the flag is not present all files from previous runs are erased at launch
-ageSet the time in second after files need to be removed (default: 86400 s = 1d)
+ +

Advanced parameters

+ + + + + + + + + + + + + + + + + + + + + + +
FlagDescription
-mTSingle job at a time (excludes the use of -after, only use if you’re sure to be the only one accessing the server)
-fMRun as a function, without fork
-maxCJ nLimit the maximum number of jobs running in parallel.
+ + +
+
+
+ + + \ No newline at end of file diff --git a/usingTheInterfaces.html b/usingTheInterfaces.html new file mode 100644 index 0000000..81ee8ce --- /dev/null +++ b/usingTheInterfaces.html @@ -0,0 +1,503 @@ + + + + + + + + + + + + + + + + + + + + +Using the interfaces | G2S: The GeoStatistical Server + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +

G2S: The GeoStatistical Server

+
+

A free and flexible multiple point (geo)statistics framework including state-of-the-art algorithms: QuickSampling and Narrow Distribution Selection

+ +
+
+ +
+
+ +
+

Using the interfaces

+ +

A call to g2s is needed to launch any computation. Each call to g2s is composed of parameters of G2S and of the name of the algorithm used. Flags do NOT have a specific order.

+ + +
+

+ +

+
+ +
+ +

Use g2s in Python

+ +
from g2s import g2s
+data = g2s(...)  # it returns a tuple that contains all the output maps and the computing duration
+
+

You can either write '-flag',value or flag=value or a mix of both.

+ +
+ +
+ +

Use g2s in MATLAB

+ +
data = g2s(...)          % principal output, the simulation
+[data, t] = g2s(...)     % the simulation and the computation time
+[data, ...,t] = g2s(...) % the simulation, other outputs map and the computation time
+
+

A call to g2s is needed to launch any computation. Each call to g2s is composed of parameters of G2S and of the name of the algorithm used. +Flags do NOT have a specific order. +You can either write '-flag',value or flag=value or a mix of both.

+ +
+ +
+ +

Use g2s in R

+ +

The R interface is not available at this moment. Please contact g2s@mgravey.com if you need it.

+ +
+ +

Inteface flags

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FlagDescription
--versionReturn the version and compilation date of the interface
-aThe simulation algorithm to be used, it can be ‘qs’, ‘nds’, ‘ds-l’ (DS-like, not maintained)
-saServer address (default: localhost (the server is local), otherwise provide IP address). Nice when we have a powerful machine dedicated for computation
-pPort where to look for the server (default: 8128). Should be passed as an integer.
-silentDon’t display the progression, useful for scripts
-serverStatusInform if the server is working properly
<1 → error, such as comunication, server shutdown,…)
=0 → undefined
>1 → server is operational
1: standard server working normaly
-noTODeactivate TimeOut on ZMQ communication, useful for slow network (e.g., through internet)
-TOSpecify a custom TimeOut on ZMQ communication( uint32 in millisecond )
-shutdownShutdown the server, useful at the end of scripts
+ +

Asynchronous mode flags

+

The following options represent the Asynchronous mode, which allows you to submit multiple jobs simultaneously and retrieve the results of each of them later on (as opposed to synchronous communication with the server, where you need to wait until a job is finished before you can submit a new one). You launch the async mode by simply adding the -submitOnly flag to your g2s call. This will give only the job ID as an output, so the g2s call becomes jobid = g2s(flag1,value1, flag2,value2, ...). Don’t forget to always include the server address if it’s not local! See the example section for a demonstration in MATLAB and Python.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FlagDescription
-submitOnlySubmit a job
-statusOnlyCheck progression
Usage: status = g2s('-statusOnly',jobid)
-waitAndDownloadDownload the result
Usage: sim,_ = g2s('-waitAndDownload',jobid)
-killKill a given task
Usage: g2s('-kill',jobid)
-afterExecute the job after another one is finished (e.g. -after,previousJobId )
+ + +
+
+
+ + + \ No newline at end of file