@@ -160,7 +160,7 @@ def create_grid(self) -> Dict[str, np.ndarray]:
160160
161161 def get_distance_equator (self ):
162162 """Return distance between points at the equator."""
163- d_lon = deg_to_eq_spacing (self .grid_step_lon , radius = 6371 )
163+ d_lon = deg_to_equatorial_distance (self .grid_step_lon , radius = 6371 )
164164 return d_lon
165165
166166 @staticmethod
@@ -220,7 +220,7 @@ def create_grid(self): # TODO: 确认高斯网格的起止点
220220
221221 def get_distance_equator (self ):
222222 """Return distance between points at the equator."""
223- d_lon = deg_to_eq_spacing (self .grid_step_lon , radius = 6371 )
223+ d_lon = deg_to_equatorial_distance (self .grid_step_lon , radius = 6371 )
224224 return d_lon
225225
226226
@@ -742,7 +742,7 @@ def to_cdo_gridfile(self, filepath = None, out_vertex = False):
742742
743743 def to_gridfile (self , filepath = None , out_vertex = False ):
744744 if filepath is None :
745- filepath = f'feketegrid_ { self .num_points } _ { self .num_iter } .txt'
745+ filepath = f'feketegrid_n { self .num_points } _it { self .num_iter } .txt'
746746 with open (filepath , 'w' ) as fp :
747747 fp .write ("gridtype\t = unstructured\n " )
748748 fp .write (f"gridsize\t = { self .num_points } \n " )
@@ -884,9 +884,7 @@ def spherical_distance_objective(rotation_vector):
884884 final_points = final_points / np .linalg .norm (final_points , axis = 1 , keepdims = True )
885885
886886 # Convert back to spherical coordinates
887- new_lon , new_lat = cart_to_geo (final_points [:, 0 ],
888- final_points [:, 1 ],
889- final_points [:, 2 ])
887+ new_lon , new_lat = cart_to_geo (final_points [:, 0 ], final_points [:, 1 ], final_points [:, 2 ])
890888
891889 return {
892890 'lon' : new_lon ,
@@ -1175,8 +1173,7 @@ def geo_distance(lon1: Union[float, np.ndarray], lat1: Union[float, np.ndarray],
11751173 return radius * c
11761174
11771175
1178-
1179- def deg_to_eq_spacing (grid_step : float , radius : float = 6371 ) -> float :
1176+ def deg_to_equatorial_distance (grid_step : float , radius : float = 6371 ) -> float :
11801177 """Convert angular grid resolution (degrees) to equivalent distance at the equator (km).
11811178
11821179 Args:
@@ -1194,7 +1191,8 @@ def deg_to_eq_spacing(grid_step: float, radius: float = 6371) -> float:
11941191
11951192 return geo_distance (0 , 0 , grid_step , 0 , radius = radius )
11961193
1197- def eq_spacing_to_deg (distance : float , radius : float = 6371 ) -> float :
1194+
1195+ def equatorial_distance_to_deg (distance : float , radius : float = 6371 ) -> float :
11981196 """Convert equatorial distance (km) to equivalent angular grid resolution (degrees).
11991197
12001198 Args:
@@ -1212,7 +1210,7 @@ def eq_spacing_to_deg(distance: float, radius: float = 6371) -> float:
12121210
12131211 return distance * 360 / (2 * np .pi * radius )
12141212
1215- # def min_dists(grid1, grid2 = None):
1213+ # def min_dists(grid1, grid2 = None): TODO: implement grid2 but I dont know why need it
12161214# if grid2 is None:
12171215# lon1, lon2 = grid1['lon'], grid1['lon']
12181216# lat1, lat2 = grid1['lat'], grid1['lat']
0 commit comments