forked from husseinaluie/FlowSieve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostprocess.hpp
150 lines (134 loc) · 5.43 KB
/
postprocess.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#ifndef POSTPROCESS_HPP
#define POSTPROCESS_HPP 1
#include <vector>
#include <string>
#include <math.h>
#include <mpi.h>
#include "functions.hpp" // provides classes
void Apply_Postprocess_Routines(
const dataset & source_data,
const std::vector<const std::vector<double>*> & postprocess_fields,
const std::vector<std::string> & vars_to_process,
const std::vector<double> & OkuboWeiss,
const double filter_scale,
Timing_Records & timing_records,
const std::string filename_base = "postprocess",
const MPI_Comm comm = MPI_COMM_WORLD
);
void write_regions(
const char * filename,
const std::vector<double> & latitude,
const std::vector<double> & longitude,
const std::vector<bool> & mask,
const std::vector<double> & areas,
const std::vector<int> & myCounts,
const std::vector<int> & myStarts,
const MPI_Comm comm = MPI_COMM_WORLD
);
void compute_region_areas(
std::vector<double> & region_areas,
const std::vector<double> & areas,
const std::vector<bool> & mask,
const std::vector<double> & latitude,
const std::vector<double> & longitude,
const int num_regions,
const int Ntime,
const int Ndepth,
const int Nlat,
const int Nlon
);
void compute_region_avg_and_std(
std::vector< std::vector< double > > & field_averages,
std::vector< std::vector< double > > & field_std_devs,
const dataset & source_data,
const std::vector<const std::vector<double>*> & postprocess_fields,
const MPI_Comm comm = MPI_COMM_WORLD
);
void compute_zonal_avg_and_std(
std::vector< std::vector< double > > & zonal_averages,
std::vector< std::vector< double > > & zonal_std_devs,
const dataset & source_data,
const std::vector<const std::vector<double>*> & postprocess_fields,
const MPI_Comm comm = MPI_COMM_WORLD
);
void compute_region_avg_and_std_OkuboWeiss(
std::vector< std::vector< double > > & field_averages,
std::vector< std::vector< double > > & field_std_devs,
std::vector< double > & OkuboWeiss_areas,
const dataset & source_data,
const std::vector<const std::vector<double>*> & postprocess_fields,
const std::vector<double> & OkuboWeiss,
const std::vector<double> OkuboWeiss_bounds,
const int NOkubo
);
void compute_time_avg_std(
std::vector<std::vector<double> > & time_average,
std::vector<std::vector<double> > & time_std_dev,
const dataset & source_data,
const std::vector<const std::vector<double>*> & postprocess_fields,
const std::vector<int> & mask_count,
const std::vector<bool> & always_masked,
const int full_Ntime
);
void write_region_avg_and_std(
const std::vector< std::vector< double > > & field_averages,
const std::vector< std::vector< double > > & field_std_devs,
const std::vector<std::string> & vars_to_process,
const char * filename,
const int Stime,
const int Sdepth,
const int Ntime,
const int Ndepth,
const int num_regions,
const int num_fields
);
void write_zonal_avg_and_std(
const std::vector< std::vector< double > > & zonal_averages,
const std::vector< std::vector< double > > & zonal_std_devs,
const std::vector<std::string> & vars_to_process,
const char * filename,
const int Stime,
const int Sdepth,
const int Ntime,
const int Ndepth,
const int Nlat,
const int num_fields
);
void write_region_avg_and_std_OkuboWeiss(
const std::vector< std::vector< double > > & field_averages_OW,
const std::vector< std::vector< double > > & field_std_devs_OW,
const std::vector< double > & OkuboWeiss_areas,
const std::vector<std::string> & vars_to_process,
const char * filename,
const int Stime,
const int Sdepth,
const int Ntime,
const int Ndepth,
const int Nokubo,
const int num_regions,
const int num_fields
);
namespace RegionTest
{
const double D2R = M_PI / 180.;
const double R2D = 180. / M_PI;
extern bool Global(double latitude, double longitude);
extern bool GulfofMexico(double latitude, double longitude);
extern bool GulfStream(double latitude, double longitude);
extern bool Tropics(double latitude, double longitude);
extern bool NorthofTropics(double latitude, double longitude);
extern bool SouthofTropics(double latitude, double longitude);
extern bool Kuroshio(double latitude, double longitude);
extern bool AntarcticCircumpolar(double latitude, double longitude);
// Add a variable which points to all of the ( currently defined )
// regions. This will make it easier for post-process routines
// to simply loop through the whole set.
// First one points to functions, second one gives (human-readable) names
// currently, printing a dimension with string values doesn't seem to
// work in parallel netcdf. Until I find a way around this, I'm just going
// to flub it and add a bunch of attributes (hopefully)
extern const std::vector< bool(*)(double, double) > all_regions;
//extern char const ** region_names;
extern const std::vector< std::string > region_names;
}
#endif