Skip to content

Commit 567fd99

Browse files
committed
change cos_lat limits and use clamp
1 parent e2caabe commit 567fd99

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/grid_sphere.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void Grid::create_sphere_grid(Quadtree quadtree) {
154154
}
155155

156156
arma_cube cos_lat = cos(geoLat_scgc);
157-
cos_lat.elem( find(cos_lat < 0.00001) ).fill(0.00001);
157+
cos_lat.clamp(0.0001, 1.0);
158158

159159
y_Center = geoLat_scgc;
160160
x_Center = geoLon_scgc % cos_lat;
@@ -180,7 +180,7 @@ void Grid::create_sphere_grid(Quadtree quadtree) {
180180
}
181181

182182
arma_cube cos_lat_L = cos(geoLat_Left);
183-
cos_lat_L.elem( find(cos_lat_L < 0.00001) ).fill(0.00001);
183+
cos_lat_L.clamp(0.0001, 1.0);
184184

185185
x_Left = geoLon_Left % cos_lat_L;
186186
dy_Left.set_size(nLons, nLats, nAlts);
@@ -206,7 +206,7 @@ void Grid::create_sphere_grid(Quadtree quadtree) {
206206
}
207207

208208
arma_cube cos_lat_D = cos(geoLat_Down);
209-
cos_lat_D.elem( find(cos_lat_D < 0.00001) ).fill(0.00001);
209+
cos_lat_D.clamp(0.0001, 1.0);
210210

211211
y_Down = geoLat_Down;
212212
dx_Down = dlon * cos_lat_D;

0 commit comments

Comments
 (0)