Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cspp-geo-gridded-glm
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor 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
cspp_geo
cspp-geo-gridded-glm
Commits
00111a19
Commit
00111a19
authored
2 years ago
by
Nick Bearson
Browse files
Options
Downloads
Patches
Plain Diff
moving more input handling out of grid_setup; prep-work for calling the gridder once per minute
parent
83b42a46
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!26
group inputs by minute and process accordingly
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gridded_glm/libexec/_minute_gridder.py
+13
-11
13 additions, 11 deletions
gridded_glm/libexec/_minute_gridder.py
with
13 additions
and
11 deletions
gridded_glm/libexec/_minute_gridder.py
+
13
−
11
View file @
00111a19
...
...
@@ -185,26 +185,21 @@ def get_outpath_base(args):
return
dsname
def
grid_setup
(
args
,
work_dir
=
os
.
getcwd
()):
def
grid_setup
(
glm_files
,
args
,
work_dir
=
os
.
getcwd
()):
# When passed None for the minimum event or group counts, the gridder will skip
# the check, saving a bit of time.
min_events
=
None
min_groups
=
None
for
f
in
args
.
filenames
:
if
not
os
.
path
.
exists
(
f
):
log
.
error
(
"
Tried to grid file that does not exist: {}
"
.
format
(
f
))
exit
(
1
)
if
args
.
goes_sector
==
"
meso
"
and
(
args
.
ctr_lat
==
None
or
args
.
ctr_lon
==
None
):
log
.
error
(
"
sector
'
meso
'
requires --ctr-lat & --ctr-lon
"
)
exit
(
1
)
try
:
start_time
,
end_time
=
get_start_end
(
args
.
filenam
es
)
start_time
,
end_time
=
get_start_end
(
glm_fil
es
)
except
:
log
.
error
(
"
Could not parse start & end times from one or more of the files provided:
"
)
log
.
error
(
"
,
"
.
join
(
args
.
filenam
es
))
log
.
error
(
"
,
"
.
join
(
glm_fil
es
))
exit
(
1
)
base_date
=
datetime
(
start_time
.
year
,
start_time
.
month
,
start_time
.
day
)
...
...
@@ -212,7 +207,7 @@ def grid_setup(args, work_dir=os.getcwd()):
outputpath
=
os
.
path
.
join
(
work_dir
,
get_outpath_base
(
args
))
# GLMTools expects a template in addition to the path
goes_position
=
get_goes_position
(
args
.
filenam
es
)
goes_position
=
get_goes_position
(
glm_fil
es
)
resln
=
get_resolution
(
args
)
view
=
get_GOESR_grid
(
position
=
goes_position
,
...
...
@@ -276,7 +271,7 @@ def grid_setup(args, work_dir=os.getcwd()):
if
(
proj_name
==
'
pixel_grid
'
)
or
(
proj_name
==
'
geos
'
):
grid_kwargs
[
'
pixel_coords
'
]
=
fixed_grid
grid_kwargs
[
'
ellipse_rev
'
]
=
-
1
# -1 (default) = infer from date in each GLM file
return
gridder
,
args
.
filenam
es
,
start_time
,
end_time
,
grid_kwargs
return
gridder
,
glm_fil
es
,
start_time
,
end_time
,
grid_kwargs
def
get_cspp_gglm_version
():
...
...
@@ -318,6 +313,7 @@ if __name__ == '__main__':
log
.
info
(
"
Starting GLM Gridding
"
)
log
.
debug
(
"
Starting script with: %s
"
,
sys
.
argv
)
# handle the realtime flag
if
args
.
realtime
:
if
len
(
args
.
filenames
)
!=
1
:
log
.
error
(
"
realtime mode only accepts one input file
"
)
...
...
@@ -331,6 +327,12 @@ if __name__ == '__main__':
exit
(
0
)
args
.
filenames
=
fileglob
# check that all of our inputs exist
for
f
in
args
.
filenames
:
if
not
os
.
path
.
exists
(
f
):
log
.
error
(
"
Tried to grid file that does not exist: {}
"
.
format
(
f
))
exit
(
1
)
# set up output dir
os
.
makedirs
(
args
.
output_dir
,
exist_ok
=
True
)
...
...
@@ -341,7 +343,7 @@ if __name__ == '__main__':
atexit
.
register
(
shutil
.
rmtree
,
tempdir_path
)
# do the gridding
gridder
,
glm_filenames
,
start_time
,
end_time
,
grid_kwargs
=
grid_setup
(
args
,
work_dir
=
tempdir_path
)
gridder
,
glm_filenames
,
start_time
,
end_time
,
grid_kwargs
=
grid_setup
(
args
.
filenames
,
args
,
work_dir
=
tempdir_path
)
gridder_return
=
gridder
(
glm_filenames
,
start_time
,
end_time
,
**
grid_kwargs
)
gridded_files
=
[]
...
...
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