Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
d243bb45
Commit
d243bb45
authored
Feb 17, 2021
by
Felix Kleinert
Browse files
Options
Downloads
Patches
Plain Diff
clean some functions from outcommented lines
parent
de06cb56
No related branches found
No related tags found
1 merge request
!231
Draft: Resolve "Create WRF-Chem data handler"
Pipeline
#60135
passed with warnings
Feb 17, 2021
Stage: test
Stage: docs
Stage: pages
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
mlair/helpers/geofunctions.py
+3
-5
3 additions, 5 deletions
mlair/helpers/geofunctions.py
mlair/helpers/helpers.py
+0
-1
0 additions, 1 deletion
mlair/helpers/helpers.py
with
3 additions
and
6 deletions
mlair/helpers/geofunctions.py
+
3
−
5
View file @
d243bb45
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
mlair/helpers/helpers.py
+
0
−
1
View file @
d243bb45
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment