82 lines
3.3 KiB
C++
82 lines
3.3 KiB
C++
/********************************************************
|
|
* ██████╗ ██████╗████████╗██╗
|
|
* ██╔════╝ ██╔════╝╚══██╔══╝██║
|
|
* ██║ ███╗██║ ██║ ██║
|
|
* ██║ ██║██║ ██║ ██║
|
|
* ╚██████╔╝╚██████╗ ██║ ███████╗
|
|
* ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
*
|
|
* 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 "gctl/core.h"
|
|
#include "gctl/io.h"
|
|
#include "gctl/potential.h"
|
|
#include "iostream"
|
|
|
|
int main(int argc, char const *argv[]) try
|
|
{
|
|
// set up observation parameters and block parameters
|
|
double lon, lat;
|
|
gctl::array<gctl::point3ds> obes(201*201);
|
|
for (int i = 0; i < 201; i++)
|
|
{
|
|
lat = 20.0 + 0.25*i;
|
|
for (int j = 0; j < 201; j++)
|
|
{
|
|
lon = 65.0 + 0.25*j;
|
|
obes[i*201+j].lon = lon;
|
|
obes[i*201+j].lat = lat;
|
|
obes[i*201+j].rad = GCTL_Earth_Radius + 40000.0;
|
|
}
|
|
}
|
|
|
|
gctl::array<gctl::mag_tesseroid> tesses(1);
|
|
gctl::array<gctl::magtess_para> mtess(1);
|
|
tesses[0].set(GCTL_Earth_Radius - 11650.0, GCTL_Earth_Radius - 1000.0, 89, 91, 44, 46);
|
|
mtess[0].bx = 23458.6;
|
|
mtess[0].by = 840.2;
|
|
mtess[0].bz = 53040.0;
|
|
gctl::link_entity_attribute(tesses, mtess);
|
|
|
|
gctl::array<double> rho(1, 1.0);
|
|
gctl::array<double> sus(1, 1.0);
|
|
|
|
gctl::array<double> data;
|
|
|
|
#ifdef GCTL_NETCDF
|
|
magobser(data, tesses, obes, rho, sus, gctl::Za, gctl::ShortMsg);
|
|
gctl::save_netcdf_grid("data/tesseroid_mag", data, 201, 201, -25.0, 0.25, -25.0, 0.25, "x", "y", "Za");
|
|
|
|
magobser(data, tesses, obes, rho, sus, gctl::Hax, gctl::ShortMsg);
|
|
gctl::append_netcdf_grid("data/tesseroid_mag", data, "x", "y", "Hax");
|
|
|
|
magobser(data, tesses, obes, rho, sus, gctl::Hay, gctl::ShortMsg);
|
|
gctl::append_netcdf_grid("data/tesseroid_mag", data, "x", "y", "Hay");
|
|
#else
|
|
magobser(data, tesses, obes, rho, sus, gctl::Za, gctl::ShortMsg);
|
|
gctl::save_surfer6_grid("data/tesseroid_mag", data, 201, 201, -25.0, 25.0, -25.0, 25.0, NAN, NAN, gctl::Surfer6Binary);
|
|
#endif // GCTL_NETCDF
|
|
|
|
return 0;
|
|
}
|
|
catch (std::exception &e)
|
|
{
|
|
GCTL_ShowWhatError(e.what(), GCTL_ERROR_ERROR, 0, 0, 0);
|
|
} |