Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
toargridding
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
esde
toar-public
toargridding
Commits
9513b475
Commit
9513b475
authored
10 months ago
by
Carsten Hinz
Browse files
Options
Downloads
Patches
Plain Diff
fixed time difference for monthly and annual sampling
added documentation
parent
4da83bc5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!11
Creation of first beta release version
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
toargridding/metadata.py
+4
-6
4 additions, 6 deletions
toargridding/metadata.py
toargridding/static_metadata.py
+7
-1
7 additions, 1 deletion
toargridding/static_metadata.py
toargridding/toar_rest_client.py
+10
-1
10 additions, 1 deletion
toargridding/toar_rest_client.py
with
21 additions
and
8 deletions
toargridding/metadata.py
+
4
−
6
View file @
9513b475
...
@@ -67,7 +67,7 @@ class TimeSample:
...
@@ -67,7 +67,7 @@ class TimeSample:
def
daterange_option
(
self
)
->
str
:
def
daterange_option
(
self
)
->
str
:
"""
Conversion of range to a string
"""
Conversion of range to a string
Range is given as start
<=incuded days <
end
Range is given as
[
start
,
end
)
"""
"""
end_with_padding
=
self
.
end
+
timedelta
(
1
)
end_with_padding
=
self
.
end
+
timedelta
(
1
)
return
f
"
{
self
.
start
.
isoformat
()
}
,
{
end_with_padding
.
isoformat
()
}
"
return
f
"
{
self
.
start
.
isoformat
()
}
,
{
end_with_padding
.
isoformat
()
}
"
...
@@ -84,9 +84,8 @@ class TimeSample:
...
@@ -84,9 +84,8 @@ class TimeSample:
Calculates the duration in days relative to start time point.
Calculates the duration in days relative to start time point.
"""
"""
#TODO: could this be an issue for monthly sampling?
tp
=
self
.
as_datetime_index
()
n_days
=
(
self
.
end
-
self
.
start
).
days
return
np
.
array
([
(
t
-
tp
[
0
]).
days
for
t
in
tp
])
return
np
.
arange
(
n_days
+
1
)
@dataclass
@dataclass
...
@@ -121,8 +120,6 @@ class Metadata:
...
@@ -121,8 +120,6 @@ class Metadata:
"""
"""
variable
=
TOARVariable
.
get
(
standart_name
)
variable
=
TOARVariable
.
get
(
standart_name
)
return
Metadata
(
variable
,
time
,
stat
)
return
Metadata
(
variable
,
time
,
stat
)
@property
@property
...
@@ -209,6 +206,7 @@ def get_cf_metadata(variable: Variables, metadata: Metadata | None)-> Dict:
...
@@ -209,6 +206,7 @@ def get_cf_metadata(variable: Variables, metadata: Metadata | None)-> Dict:
The resulting dictionary contains the required values for the netCDF files.
The resulting dictionary contains the required values for the netCDF files.
"""
"""
match
variable
.
name
:
match
variable
.
name
:
case
Variables
.
latitude
.
name
:
case
Variables
.
latitude
.
name
:
cf_metadata
=
{
cf_metadata
=
{
...
...
This diff is collapsed.
Click to expand it.
toargridding/static_metadata.py
+
7
−
1
View file @
9513b475
...
@@ -49,8 +49,14 @@ class TOARVariable:
...
@@ -49,8 +49,14 @@ class TOARVariable:
@classmethod
@classmethod
def
get
(
cls
,
standart_name
:
str
)
->
"
TOARVariable
"
:
def
get
(
cls
,
standart_name
:
str
)
->
"
TOARVariable
"
:
"""
searches the known variables for the requested variable
"""
searches the known variables for the requested variable
Parameters:
----------
standart_name:
name of the variable following the CF convention.
return: provides direct access to the meta data of the selected variable
return:
provides direct access to the meta data of the selected variable
"""
"""
for
var
in
cls
.
vars
:
for
var
in
cls
.
vars
:
if
var
.
standart_name
==
standart_name
:
if
var
.
standart_name
==
standart_name
:
...
...
This diff is collapsed.
Click to expand it.
toargridding/toar_rest_client.py
+
10
−
1
View file @
9513b475
...
@@ -380,7 +380,16 @@ class AnalysisServiceDownload(AnalysisService):
...
@@ -380,7 +380,16 @@ class AnalysisServiceDownload(AnalysisService):
self
.
sample_dir
=
sample_dir
self
.
sample_dir
=
sample_dir
self
.
use_downloaded
=
use_downloaded
self
.
use_downloaded
=
use_downloaded
def
get_timeseries_and_metadata
(
self
,
metadata
:
Metadata
):
def
get_timeseries_and_metadata
(
self
,
metadata
:
Metadata
)
->
tuple
[
pd
.
DataFrame
,
pd
.
DataFrame
]:
"""
loading of cached data or requesting of data from the TOARDB
Parameters:
----------
metadata:
information on requested data
return:
tuple[timeseries, station coordinates]
"""
filename
=
self
.
sample_dir
/
self
.
get_sample_file_name
(
metadata
)
filename
=
self
.
sample_dir
/
self
.
get_sample_file_name
(
metadata
)
query_options
=
QueryOptions
.
from_metadata
(
metadata
)
query_options
=
QueryOptions
.
from_metadata
(
metadata
)
needs_fresh_download
=
(
not
self
.
use_downloaded
)
or
(
not
filename
.
is_file
())
needs_fresh_download
=
(
not
self
.
use_downloaded
)
or
(
not
filename
.
is_file
())
...
...
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