Skip to content
Snippets Groups Projects
Commit d243bb45 authored by Felix Kleinert's avatar Felix Kleinert
Browse files

clean some functions from outcommented lines

parent de06cb56
No related branches found
No related tags found
1 merge request!231Draft: Resolve "Create WRF-Chem data handler"
Pipeline #60135 passed with warnings
...@@ -37,8 +37,7 @@ def haversine_dist(lat1: xr.DataArray, lon1: xr.DataArray, ...@@ -37,8 +37,7 @@ def haversine_dist(lat1: xr.DataArray, lon1: xr.DataArray,
Calculate the great circle distance between two points Calculate the great circle distance between two points
on the Earth (specified in decimal degrees or in radians) on the Earth (specified in decimal degrees or in radians)
All (lat, lon) coordinates must have numeric dtypes and be of equal length. Reference: ToBeAdded
An exception holds if one pair is given as a scalar, in this case broadcasting is possible
:param lat1: Latitude(-s) of first location :param lat1: Latitude(-s) of first location
:param lon1: Longitude(-s) of first location :param lon1: Longitude(-s) of first location
...@@ -56,9 +55,6 @@ def haversine_dist(lat1: xr.DataArray, lon1: xr.DataArray, ...@@ -56,9 +55,6 @@ def haversine_dist(lat1: xr.DataArray, lon1: xr.DataArray,
lon1 = convert2xrda(lon1, use_1d_default=True) lon1 = convert2xrda(lon1, use_1d_default=True)
lat2 = convert2xrda(lat2, use_1d_default=True) lat2 = convert2xrda(lat2, use_1d_default=True)
lon2 = convert2xrda(lon2, use_1d_default=True) lon2 = convert2xrda(lon2, use_1d_default=True)
# if isinstance(lat2, np.ndarray) and isinstance(lon2, np.ndarray):
# lat2 = convert_1d_np2xr(lat2)
# lon2 = convert_1d_np2xr(lon2)
assert lat1.shape == lon1.shape assert lat1.shape == lon1.shape
assert lat2.shape == lon2.shape assert lat2.shape == lon2.shape
...@@ -66,6 +62,8 @@ def haversine_dist(lat1: xr.DataArray, lon1: xr.DataArray, ...@@ -66,6 +62,8 @@ def haversine_dist(lat1: xr.DataArray, lon1: xr.DataArray,
assert isinstance(lon1, xr.DataArray) assert isinstance(lon1, xr.DataArray)
assert isinstance(lat2, xr.DataArray) assert isinstance(lat2, xr.DataArray)
assert isinstance(lon2, xr.DataArray) assert isinstance(lon2, xr.DataArray)
# broadcast lats and lons to calculate distances in a vectorized manner.
lat1, lat2 = xr.broadcast(lat1, lat2) lat1, lat2 = xr.broadcast(lat1, lat2)
lon1, lon2 = xr.broadcast(lon1, lon2) lon1, lon2 = xr.broadcast(lon1, lon2)
......
...@@ -171,7 +171,6 @@ def convert2xrda(arr: Union[xr.DataArray, xr.Dataset, np.ndarray, int, float], ...@@ -171,7 +171,6 @@ def convert2xrda(arr: Union[xr.DataArray, xr.Dataset, np.ndarray, int, float],
raise TypeError(f"`arr' must be arry-like, int or float. But is of type {type(arr)}") raise TypeError(f"`arr' must be arry-like, int or float. But is of type {type(arr)}")
kwargs.update({'dims': dims, 'coords': coords}) kwargs.update({'dims': dims, 'coords': coords})
# return xr.DataArray(arr, dims=dims, coords=coords, **kwargs)
return xr.DataArray(arr, **kwargs) return xr.DataArray(arr, **kwargs)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment