This commit is contained in:
2025-09-03 12:55:19 +08:00
parent 613c73c812
commit ea91e2e867
13 changed files with 26 additions and 21 deletions

View File

@@ -55,7 +55,7 @@ int ADDNOSIE::Addnoise(std::string infilename, std::string outfilename, int orde
int data_num = in_data_.size(); int data_num = in_data_.size();
double tmp_dou; double tmp_dou;
gctl::array<double> noises(data_num); gctl::array<double> noises(data_num);
noises.random_float(noise_mean_, noise_dev_); random_float(noises, noise_mean_, noise_dev_);
for (int i = 0; i < data_num; i++) for (int i = 0; i < data_num; i++)
{ {
tmp_dou = in_data_.at(i).at(order) + noises.at(i); tmp_dou = in_data_.at(i).at(order) + noises.at(i);

View File

@@ -30,7 +30,7 @@
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/algorithms.h" #include "gctl/math.h"
struct node struct node
{ {

View File

@@ -45,8 +45,8 @@
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/geometry.h" #include "gctl/poly.h"
#include "gctl/algorithms.h" #include "gctl/math.h"
using namespace std; using namespace std;

View File

@@ -26,9 +26,10 @@
******************************************************/ ******************************************************/
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/geometry.h" #include "gctl/poly.h"
#include "gctl/io.h" #include "gctl/io.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/math.h"
class HandyMan class HandyMan
{ {
@@ -353,7 +354,7 @@ void HandyMan::SR_GeoAngle()
std::cin >> c[i].lon >> c[i].lat; std::cin >> c[i].lon >> c[i].lat;
} }
std::cout << "The geo-centric angle is: " << gctl::geometry3d::angle(c[0].s2c(), c[1].s2c())*180.0/M_PI << " deg.\n"; std::cout << "The geo-centric angle is: " << gctl::geometry3d::angle(s2c(c[0]), s2c(c[1]))*180.0/M_PI << " deg.\n";
return; return;
} }

View File

@@ -29,9 +29,10 @@
//#include "lcg/solver.h" //#include "lcg/solver.h"
// GCTL library // GCTL library
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/geometry.h" #include "gctl/poly.h"
#include "gctl/io.h" #include "gctl/io.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/math.h"
#include "gctl/optimization.h" #include "gctl/optimization.h"
#if defined _WINDOWS || __WIN32__ #if defined _WINDOWS || __WIN32__
@@ -200,7 +201,7 @@ void LBSI::Routine(std::string in_name, std::string tar_name,
{ {
bar.progressed(i); bar.progressed(i);
Kernel.assign_all(0.0); Kernel.assign(0.0);
CalKernel(TargNodes[i]); CalKernel(TargNodes[i]);
for (size_t s = 0; s < ValSize; s++) for (size_t s = 0; s < ValSize; s++)

View File

@@ -29,8 +29,8 @@
//#include "lcg/solver.h" //#include "lcg/solver.h"
// GCTL library // GCTL library
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/algorithms.h" #include "gctl/math.h"
#include "gctl/geometry.h" #include "gctl/poly.h"
#include "gctl/io.h" #include "gctl/io.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/optimization.h" #include "gctl/optimization.h"
@@ -185,7 +185,7 @@ void LKI::Routine(std::string inname, std::string tarname, std::string outname,
{ {
bar.progressed(i); bar.progressed(i);
Kernel.assign_all(0.0); Kernel.assign(0.0);
Wgts.assign(0.0); Wgts.assign(0.0);
CalKernel(TargNodes[i]); CalKernel(TargNodes[i]);

View File

@@ -65,7 +65,7 @@ Please see instructions or contact the author for more information.");
gctl::read_netcdf_axis(in_name, out_x, x_name); gctl::read_netcdf_axis(in_name, out_x, x_name);
gctl::read_netcdf_axis(in_name, out_y, y_name); gctl::read_netcdf_axis(in_name, out_y, y_name);
gctl::read_netcdf_grid(in_name, out_data, x_name, y_name, data_name); gctl::read_netcdf_grid(in_name, out_data, x_name, y_name, data_name);
gctl::save_netcdf_grid(out_name, out_data, out_x, out_y, x_name, y_name, data_name, zmin, zmax); gctl::save_netcdf_grid(out_name, out_data, out_x, out_y, gctl::BtmLeft, x_name, y_name, data_name, zmin, zmax);
return 0; return 0;
} }
catch(std::exception &e) catch(std::exception &e)

View File

@@ -31,7 +31,7 @@
// add gctl head files // add gctl head files
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/algorithms.h" #include "gctl/math.h"
#include "gctl/io.h" #include "gctl/io.h"
#define NORMAL_GRAVITY 9.80665 // m/s^2 #define NORMAL_GRAVITY 9.80665 // m/s^2

View File

@@ -29,9 +29,10 @@
//#include "lcg/solver.h" //#include "lcg/solver.h"
// GCTL library // GCTL library
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/geometry.h" #include "gctl/poly.h"
#include "gctl/io.h" #include "gctl/io.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/math.h"
#include "gctl/optimization.h" #include "gctl/optimization.h"
#if defined _WINDOWS || __WIN32__ #if defined _WINDOWS || __WIN32__
@@ -186,7 +187,7 @@ void LBSI::Routine(std::string in_name, std::string tar_name,
{ {
bar.progressed(i); bar.progressed(i);
Kernel.assign_all(0.0); Kernel.assign(0.0);
CalKernel(TargNodes[i]); CalKernel(TargNodes[i]);
for (size_t s = 0; s < ValSize; s++) for (size_t s = 0; s < ValSize; s++)

View File

@@ -28,6 +28,7 @@
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/io.h" #include "gctl/io.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/math.h"
int main(int argc, char *argv[]) try int main(int argc, char *argv[]) try
{ {

View File

@@ -47,7 +47,7 @@
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/algorithms.h" #include "gctl/math.h"
#include "gctl/io.h" #include "gctl/io.h"
using namespace std; using namespace std;

View File

@@ -266,7 +266,7 @@ Please see instructions or contact the author for more information.");
} }
gctl::save_netcdf_grid(grid_name, out_data, xnum, ynum, xmin, dx, ymin, dy, gctl::save_netcdf_grid(grid_name, out_data, xnum, ynum, xmin, dx, ymin, dy,
label_index[0], label_index[1], label_index[2]); gctl::BtmLeft, label_index[0], label_index[1], label_index[2]);
std::string save_dataname; std::string save_dataname;
if (col_index.size() > 1) if (col_index.size() > 1)
@@ -302,7 +302,7 @@ Please see instructions or contact the author for more information.");
} }
gctl::save_netcdf_grid(grid_name, out_data, xnum, ynum, xmin, dx, ymin, dy, gctl::save_netcdf_grid(grid_name, out_data, xnum, ynum, xmin, dx, ymin, dy,
label_index[0], label_index[1], label_index[2]); gctl::BtmLeft, label_index[0], label_index[1], label_index[2]);
std::string save_dataname; std::string save_dataname;
if (col_index.size() > 3) if (col_index.size() > 3)

View File

@@ -28,6 +28,7 @@
#include "gctl/core.h" #include "gctl/core.h"
#include "gctl/io.h" #include "gctl/io.h"
#include "gctl/utility.h" #include "gctl/utility.h"
#include "gctl/math.h"
int main(int argc, char *argv[]) try int main(int argc, char *argv[]) try
{ {
@@ -134,11 +135,11 @@ The inputting continues until encounter a blank line or 'EOF'. Any lines start w
throw err_str; throw err_str;
} }
ps = pc.c2s(); ps = c2s(pc);
if (ref_str != "NULL") if (ref_str != "NULL")
{ {
ps.rad = gctl::ellipse_radius_2d(ref_R, ref_r, ps.lat*GCTL_Pi/180.0); ps.rad = gctl::ellipse_radius_2d(ref_R, ref_r, ps.lat*GCTL_Pi/180.0);
pc = ps.s2c(); pc = s2c(ps);
} }
if (verbose) std::cout << std::setprecision(pre_int) << pc.x << "," << pc.y << "," << pc.z << ","; if (verbose) std::cout << std::setprecision(pre_int) << pc.x << "," << pc.y << "," << pc.z << ",";
@@ -163,7 +164,7 @@ The inputting continues until encounter a blank line or 'EOF'. Any lines start w
{ {
ps.rad = gctl::ellipse_radius_2d(ref_R, ref_r, ps.lat*GCTL_Pi/180.0); ps.rad = gctl::ellipse_radius_2d(ref_R, ref_r, ps.lat*GCTL_Pi/180.0);
} }
pc = ps.s2c(); pc = s2c(ps);
if (verbose) std::cout << std::setprecision(pre_int) << ps.rad << "," << ps.lon << "," << ps.lat << ","; if (verbose) std::cout << std::setprecision(pre_int) << ps.rad << "," << ps.lon << "," << ps.lat << ",";
std::cout << std::setprecision(pre_int) << pc.x << "," << pc.y << "," << pc.z << std::endl; std::cout << std::setprecision(pre_int) << pc.x << "," << pc.y << "," << pc.z << std::endl;