Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
torch-harmonics
Commits
e731f2a5
Commit
e731f2a5
authored
Aug 08, 2023
by
Boris Bonev
Browse files
Fixing imports in examples
parent
3711e016
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
23 deletions
+4
-23
torch_harmonics/examples/pde_sphere.py
torch_harmonics/examples/pde_sphere.py
+2
-12
torch_harmonics/examples/shallow_water_equations.py
torch_harmonics/examples/shallow_water_equations.py
+2
-11
No files found.
torch_harmonics/examples/pde_sphere.py
View file @
e731f2a5
...
@@ -30,21 +30,11 @@
...
@@ -30,21 +30,11 @@
#
#
import
sys
sys
.
path
.
append
(
".."
)
sys
.
path
.
append
(
"."
)
import
torch
import
torch
import
torch.nn
as
nn
import
torch.nn
as
nn
import
torch_harmonics
as
harmonics
import
torch_harmonics
as
harmonics
import
numpy
as
np
import
numpy
as
np
import
matplotlib.pyplot
as
plt
try
:
import
cartopy.crs
as
ccrs
except
ImportError
:
ccrs
=
None
class
SphereSolver
(
nn
.
Module
):
class
SphereSolver
(
nn
.
Module
):
...
@@ -140,6 +130,7 @@ class SphereSolver(nn.Module):
...
@@ -140,6 +130,7 @@ class SphereSolver(nn.Module):
"""
"""
plotting routine for data on the grid. Requires cartopy for 3d plots.
plotting routine for data on the grid. Requires cartopy for 3d plots.
"""
"""
import
matplotlib.pyplot
as
plt
lons
=
self
.
lons
.
squeeze
()
-
torch
.
pi
lons
=
self
.
lons
.
squeeze
()
-
torch
.
pi
lats
=
self
.
lats
.
squeeze
()
lats
=
self
.
lats
.
squeeze
()
...
@@ -165,8 +156,7 @@ class SphereSolver(nn.Module):
...
@@ -165,8 +156,7 @@ class SphereSolver(nn.Module):
elif
projection
==
'3d'
:
elif
projection
==
'3d'
:
if
ccrs
is
None
:
import
cartopy.crs
as
ccrs
raise
ImportError
(
"Couldn't import Cartopy"
)
proj
=
ccrs
.
Orthographic
(
central_longitude
=
0.0
,
central_latitude
=
25.0
)
proj
=
ccrs
.
Orthographic
(
central_longitude
=
0.0
,
central_latitude
=
25.0
)
...
...
torch_harmonics/examples/shallow_water_equations.py
View file @
e731f2a5
...
@@ -30,22 +30,13 @@
...
@@ -30,22 +30,13 @@
#
#
import
sys
sys
.
path
.
append
(
".."
)
sys
.
path
.
append
(
"."
)
import
torch
import
torch
import
torch.nn
as
nn
import
torch.nn
as
nn
import
torch_harmonics
as
harmonics
import
torch_harmonics
as
harmonics
from
torch_harmonics.quadrature
import
*
from
torch_harmonics.quadrature
import
*
import
numpy
as
np
import
numpy
as
np
import
matplotlib.pyplot
as
plt
try
:
import
cartopy.crs
as
ccrs
except
ImportError
:
ccrs
=
None
class
ShallowWaterSolver
(
nn
.
Module
):
class
ShallowWaterSolver
(
nn
.
Module
):
"""
"""
...
@@ -337,6 +328,7 @@ class ShallowWaterSolver(nn.Module):
...
@@ -337,6 +328,7 @@ class ShallowWaterSolver(nn.Module):
"""
"""
plotting routine for data on the grid. Requires cartopy for 3d plots.
plotting routine for data on the grid. Requires cartopy for 3d plots.
"""
"""
import
matplotlib.pyplot
as
plt
lons
=
self
.
lons
.
squeeze
()
-
torch
.
pi
lons
=
self
.
lons
.
squeeze
()
-
torch
.
pi
lats
=
self
.
lats
.
squeeze
()
lats
=
self
.
lats
.
squeeze
()
...
@@ -362,8 +354,7 @@ class ShallowWaterSolver(nn.Module):
...
@@ -362,8 +354,7 @@ class ShallowWaterSolver(nn.Module):
elif
projection
==
'3d'
:
elif
projection
==
'3d'
:
if
ccrs
is
None
:
import
cartopy.crs
as
ccrs
raise
ImportError
(
"Couldn't import Cartopy"
)
proj
=
ccrs
.
Orthographic
(
central_longitude
=
0.0
,
central_latitude
=
25.0
)
proj
=
ccrs
.
Orthographic
(
central_longitude
=
0.0
,
central_latitude
=
25.0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment