/********************************************************
* ██████╗ ██████╗████████╗██╗
* ██╔════╝ ██╔════╝╚══██╔══╝██║
* ██║ ███╗██║ ██║ ██║
* ██║ ██║██║ ██║ ██║
* ╚██████╔╝╚██████╗ ██║ ███████╗
* ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
* Geophysical Computational Tools & Library (GCTL)
*
* Copyright (c) 2022 Yi Zhang (yizhang-geo@zju.edu.cn)
*
* GCTL is distributed under a dual licensing scheme. You can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 2
* of the License, or (at your option) any later version. You should have
* received a copy of the GNU Lesser General Public License along with this
* program. If not, see .
*
* If the terms and conditions of the LGPL v.2. would prevent you from using
* the GCTL, please consider the option to obtain a commercial license for a
* fee. These licenses are offered by the GCTL's original author. As a rule,
* licenses are provided "as-is", unlimited in time for a one time fee. Please
* send corresponding requests to: yizhang-geo@zju.edu.cn. Please do not forget
* to include some description of your company and the realm of its activities.
* Also add information on how to contact you by electronic and paper mail.
******************************************************/
#include "../lib/graphic/gmt.h"
#include "../lib/io/netcdf_io.h"
int main(int argc, char *argv[])
{
gctl::gmt gt;
/*
gt.begin_session("line_plot", "eps,png");
gt.call_module("basemap", "-R0/10/0/10 -JX5i/5i -Baf");
gt.call_module("plot", "tmp/data.txt -R0/10/0/10 -JX5i/5i -W1p,blue");
gt.end_session(false);
gt.save_session("line_plot");
*/
// example 2
gctl::array data(51*41);
double dist;
for (int i = 0; i < 51; ++i)
{
for (int j = 0; j < 41; ++j)
{
dist = sqrt((j-20)*(j-20) + (i-25)*(i-25));
data[j+i*41] = sin(dist/GCTL_Pi);
}
}
gctl::save_netcdf_grid("image_plot", data, 41, 51, 0.0, 1.0, 0.0, 1.0, "x", "y", "z");
gt.begin_session("image_plot", "png,eps");
gt.call_module("set", "FONT_ANNOT_PRIMARY=10.5p,Times-Roman,black \
MAP_FRAME_PEN=thinnest,black \
MAP_GRID_PEN_PRIMARY=thinnest,black \
MAP_TICK_PEN_PRIMARY=thinnest,black \
MAP_TICK_LENGTH_PRIMARY=1p/0.5p \
MAP_TITLE_OFFSET=7.5p \
MAP_GRID_CROSS_SIZE_PRIMARY=2p \
FONT_LABEL=10.5p,Times-Roman,black \
MAP_LABEL_OFFSET=5p \
MAP_ANNOT_OFFSET_PRIMARY=2.5p \
MAP_FRAME_AXES=WesNZ");
gt.call_module("grd2cpt", "image_plot.nc -R0/40/0/50 -Crainbow -Z -D");
gt.call_module("grdimage", "image_plot.nc -R0/40/0/50 -JX1.5i/1.5i -X0.5i -Y0.5i -Bxag+l\"x (m)\" -Byag+l\"y (m)\"");
gt.call_module("psscale", "-Bxa -By+lm -Dx0.1i/-0.2i+w1.3i/0.05i+h");
gt.end_session();
gt.save_session("image_plot");
return 0;
}