Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Rink
python
Commits
7b44687e
Commit
7b44687e
authored
1 year ago
by
tomrink
Browse files
Options
Downloads
Patches
Plain Diff
snapshot...
parent
49ce8e5d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/util/util.py
+18
-8
18 additions, 8 deletions
modules/util/util.py
with
18 additions
and
8 deletions
modules/util/util.py
+
18
−
8
View file @
7b44687e
...
@@ -15,6 +15,7 @@ from scipy.interpolate import RectBivariateSpline, interp2d
...
@@ -15,6 +15,7 @@ from scipy.interpolate import RectBivariateSpline, interp2d
from
scipy.ndimage
import
gaussian_filter
from
scipy.ndimage
import
gaussian_filter
from
scipy.signal
import
medfilt2d
from
scipy.signal
import
medfilt2d
from
cartopy.crs
import
Geostationary
,
Globe
from
cartopy.crs
import
Geostationary
,
Globe
import
geos_nav
LatLonTuple
=
namedtuple
(
'
LatLonTuple
'
,
[
'
lat
'
,
'
lon
'
])
LatLonTuple
=
namedtuple
(
'
LatLonTuple
'
,
[
'
lat
'
,
'
lon
'
])
...
@@ -679,23 +680,26 @@ def add_noise(data, noise_scale=0.01, seed=None, copy=True):
...
@@ -679,23 +680,26 @@ def add_noise(data, noise_scale=0.01, seed=None, copy=True):
# geos_h08_fd = pickle.load(f)
# geos_h08_fd = pickle.load(f)
# f.close()
# f.close()
geo
s_goes16_fd
=
Geostationary
(
central_longitude
=-
75.0
,
satellite_height
=
35786023.0
,
sweep_axis
=
'
x
'
,
cr
s_goes16_fd
=
Geostationary
(
central_longitude
=-
75.0
,
satellite_height
=
35786023.0
,
sweep_axis
=
'
x
'
,
globe
=
Globe
(
ellipse
=
None
,
semimajor_axis
=
6378137.0
,
semiminor_axis
=
6356752.31414
,
globe
=
Globe
(
ellipse
=
None
,
semimajor_axis
=
6378137.0
,
semiminor_axis
=
6356752.31414
,
inverse_flattening
=
298.2572221
))
inverse_flattening
=
298.2572221
))
geo
s_goes16_conus
=
Geostationary
(
central_longitude
=-
75.0
,
satellite_height
=
35786023.0
,
sweep_axis
=
'
x
'
,
cr
s_goes16_conus
=
Geostationary
(
central_longitude
=-
75.0
,
satellite_height
=
35786023.0
,
sweep_axis
=
'
x
'
,
globe
=
Globe
(
ellipse
=
None
,
semimajor_axis
=
6378137.0
,
semiminor_axis
=
6356752.31414
,
globe
=
Globe
(
ellipse
=
None
,
semimajor_axis
=
6378137.0
,
semiminor_axis
=
6356752.31414
,
inverse_flattening
=
298.2572221
))
inverse_flattening
=
298.2572221
))
geo
s_h08_fd
=
Geostationary
(
central_longitude
=
140.7
,
satellite_height
=
35785.863
,
sweep_axis
=
'
y
'
,
cr
s_h08_fd
=
Geostationary
(
central_longitude
=
140.7
,
satellite_height
=
35785.863
,
sweep_axis
=
'
y
'
,
globe
=
Globe
(
ellipse
=
None
,
semimajor_axis
=
6378.137
,
semiminor_axis
=
6356.7523
,
globe
=
Globe
(
ellipse
=
None
,
semimajor_axis
=
6378.137
,
semiminor_axis
=
6356.7523
,
inverse_flattening
=
298.25702
))
inverse_flattening
=
298.25702
))
geos_goes16_fd
=
geos_nav
.
GEOSNavigation
()
geos_goes16_conus
=
geos_nav
.
GEOSNavigation
(
CFAC
=
5.6E-05
,
LFAC
=-
5.6E-05
,
COFF
=-
0.101332
,
LOFF
=
0.128212
,
num_elems
=
2500
,
num_lines
=
1500
)
def
get_cartopy_crs
(
satellite
,
domain
):
def
get_cartopy_crs
(
satellite
,
domain
):
if
satellite
==
'
GOES16
'
:
if
satellite
==
'
GOES16
'
:
if
domain
==
'
FD
'
:
if
domain
==
'
FD
'
:
geos
=
geo
s_goes16_fd
geos
=
cr
s_goes16_fd
xlen
=
5424
xlen
=
5424
xmin
=
-
5433893.0
xmin
=
-
5433893.0
xmax
=
5433893.0
xmax
=
5433893.0
...
@@ -703,7 +707,7 @@ def get_cartopy_crs(satellite, domain):
...
@@ -703,7 +707,7 @@ def get_cartopy_crs(satellite, domain):
ymin
=
-
5433893.0
ymin
=
-
5433893.0
ymax
=
5433893.0
ymax
=
5433893.0
elif
domain
==
'
CONUS
'
:
elif
domain
==
'
CONUS
'
:
geos
=
geo
s_goes16_conus
geos
=
cr
s_goes16_conus
xlen
=
2500
xlen
=
2500
xmin
=
-
3626269.5
xmin
=
-
3626269.5
xmax
=
1381770.0
xmax
=
1381770.0
...
@@ -711,7 +715,7 @@ def get_cartopy_crs(satellite, domain):
...
@@ -711,7 +715,7 @@ def get_cartopy_crs(satellite, domain):
ymin
=
1584175.9
ymin
=
1584175.9
ymax
=
4588198.0
ymax
=
4588198.0
elif
satellite
==
'
H08
'
:
elif
satellite
==
'
H08
'
:
geos
=
geo
s_h08_fd
geos
=
cr
s_h08_fd
xlen
=
5500
xlen
=
5500
xmin
=
-
5498.99990119
xmin
=
-
5498.99990119
xmax
=
5498.99990119
xmax
=
5498.99990119
...
@@ -719,7 +723,7 @@ def get_cartopy_crs(satellite, domain):
...
@@ -719,7 +723,7 @@ def get_cartopy_crs(satellite, domain):
ymin
=
-
5498.99990119
ymin
=
-
5498.99990119
ymax
=
5498.99990119
ymax
=
5498.99990119
elif
satellite
==
'
H09
'
:
elif
satellite
==
'
H09
'
:
geos
=
geo
s_h08_fd
geos
=
cr
s_h08_fd
xlen
=
5500
xlen
=
5500
xmin
=
-
5498.99990119
xmin
=
-
5498.99990119
xmax
=
5498.99990119
xmax
=
5498.99990119
...
@@ -840,7 +844,8 @@ taiwain_extent = [-3342, -502, 1470, 3510] # GEOS coordinates, not line, elem
...
@@ -840,7 +844,8 @@ taiwain_extent = [-3342, -502, 1470, 3510] # GEOS coordinates, not line, elem
# ------------ This code will not be needed when we implement a Fully Convolutional CNN -----------------------------------
# ------------ This code will not be needed when we implement a Fully Convolutional CNN -----------------------------------
# Generate and return tiles of name_list parameters
# Generate and return tiles of name_list parameters
def
make_for_full_domain_predict
(
h5f
,
name_list
=
None
,
satellite
=
'
GOES16
'
,
domain
=
'
FD
'
,
res_fac
=
1
):
def
make_for_full_domain_predict
(
h5f
,
name_list
=
None
,
satellite
=
'
GOES16
'
,
domain
=
'
FD
'
,
res_fac
=
1
,
data_extent
=
None
):
w_x
=
16
w_x
=
16
w_y
=
16
w_y
=
16
i_0
=
0
i_0
=
0
...
@@ -849,6 +854,11 @@ def make_for_full_domain_predict(h5f, name_list=None, satellite='GOES16', domain
...
@@ -849,6 +854,11 @@ def make_for_full_domain_predict(h5f, name_list=None, satellite='GOES16', domain
s_y
=
int
(
w_y
/
res_fac
)
s_y
=
int
(
w_y
/
res_fac
)
geos
,
xlen
,
xmin
,
xmax
,
ylen
,
ymin
,
ymax
=
get_cartopy_crs
(
satellite
,
domain
)
geos
,
xlen
,
xmin
,
xmax
,
ylen
,
ymin
,
ymax
=
get_cartopy_crs
(
satellite
,
domain
)
if
satellite
==
'
GOES16
'
:
if
data_extent
is
not
None
:
ll_pt_a
=
data_extent
[
0
]
ll_pt_b
=
data_extent
[
1
]
if
satellite
==
'
H08
'
:
if
satellite
==
'
H08
'
:
xlen
=
taiwan_lenx
xlen
=
taiwan_lenx
ylen
=
taiwan_leny
ylen
=
taiwan_leny
...
...
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
register
or
sign in
to comment