Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
csppfetch
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
csppfetch
Commits
49657ebe
Commit
49657ebe
authored
3 years ago
by
Alan De Smet
Browse files
Options
Downloads
Patches
Plain Diff
aitf.ancil.GFS needs custom get_cachefilesets
parent
52489fde
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
example/aitf/ancil.py
+29
-0
29 additions, 0 deletions
example/aitf/ancil.py
with
29 additions
and
0 deletions
example/aitf/ancil.py
+
29
−
0
View file @
49657ebe
...
...
@@ -5,6 +5,7 @@ import sys
import
datetime
as
dt
sys
.
path
.
append
(
os
.
path
.
abspath
(
'
..
'
))
import
csppfetch
import
csppfetch.daterange
from
csppfetch.roundtozero
import
roundtozero
################################################################################
...
...
@@ -104,6 +105,34 @@ class GFSDownloader(csppfetch.Downloader):
local
=
self
.
_expand
(
self
.
local
,
time
,
hours_str
)
return
{
url
:
local
}
def
get_cache_filesets
(
self
,
start
=
None
,
end
=
None
):
# A copy of Downloader's implementation, but we don't use
# self._daterange; we call daterange.daterange directly so we can pass
# in a step of self.forecast_step instead of self.period. We do this
# because although our period is only every 6 hours, we change which
# files someone might want every _3_. That is to process 5Z data, we'd
# use the 0Z GFS data's 3 and 6 hour forecasts, but for 7Z data, we'd
# use the 0Z GFS data's 6 and 9 hour forecasts.
#
# Perhaps the ablity to override the period here should be in the
# parent class? Or maybe this case is too specialized to bother.
if
self
.
oldest_cache
<
dt
.
timedelta
(
days
=
0
):
raise
ValueError
(
f
"
oldest_cache should be positive; it is
{
self
.
oldest_cache
}
"
)
if
end
is
None
:
end
=
dt
.
datetime
.
now
()
if
start
is
None
:
start
=
end
-
self
.
oldest_cache
if
start
>
end
:
raise
ValueError
(
f
"
start (
{
start
}
) should be before end (
{
end
}
)
"
)
fileset_list_list
=
[]
for
time
in
csppfetch
.
daterange
.
daterange
(
end
,
start
,
-
self
.
forecast_step
,
inclusive
=
True
):
fileset_list
=
self
.
get_filesets_for_time
(
time
)
fileset_list_list
.
append
(
fileset_list
)
return
fileset_list_list
def
get_filesets_for_time
(
self
,
scan_time
):
generated_time
=
self
.
_nearest_preceeding_time
(
scan_time
)
time_since_gen
=
scan_time
-
generated_time
...
...
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