Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flex Extract
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Flexpart
Flex Extract
Commits
4ef5ba91
Commit
4ef5ba91
authored
5 years ago
by
Anne Philipp
Browse files
Options
Downloads
Patches
Plain Diff
python2 downgrade/ added import of missing eccodes function
parent
b957ef79
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/python/classes/GribUtil.py
+16
-7
16 additions, 7 deletions
source/python/classes/GribUtil.py
with
16 additions
and
7 deletions
source/python/classes/GribUtil.py
+
16
−
7
View file @
4ef5ba91
#!/usr/bin/env python
3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#*******************************************************************************
# @Author: Anne Fouilloux (University of Oslo)
...
...
@@ -42,12 +42,9 @@
# ------------------------------------------------------------------------------
# MODULES
# ------------------------------------------------------------------------------
import
os
from
__future__
import
print_function
from
eccodes
import
(
codes_grib_new_from_file
,
codes_is_defined
,
codes_get
,
codes_release
,
codes_set
,
codes_write
,
codes_index_read
,
codes_index_new_from_file
,
codes_index_add_file
,
codes_index_write
,
codes_set_values
)
import
os
# ------------------------------------------------------------------------------
# CLASS
...
...
@@ -97,6 +94,8 @@ class GribUtil(object):
return_list : :obj:`list` of :obj:`string`
List of keyvalues for given keynames.
'''
from
eccodes
import
(
codes_new_from_file
,
codes_is_defined
,
codes_get
,
codes_release
)
fileid
=
open
(
self
.
filenames
,
'
r
'
)
...
...
@@ -174,6 +173,10 @@ class GribUtil(object):
------
'''
from
eccodes
import
(
codes_grib_new_from_file
,
codes_is_defined
,
codes_get
,
codes_set
,
codes_write
,
codes_set_values
,
codes_release
)
if
len
(
wherekeynames
)
!=
len
(
wherekeyvalues
):
raise
Exception
(
"
Give a value for each keyname!
"
)
...
...
@@ -244,10 +247,13 @@ class GribUtil(object):
------
'''
from
eccodes
import
(
codes_grib_new_from_file
,
codes_is_defined
,
codes_get
,
codes_release
,
codes_write
)
if
len
(
keynames
)
!=
len
(
keyvalues
):
raise
Exception
(
"
Give a value for each keyname!
"
)
fin
=
open
(
filename_in
)
fin
=
open
(
filename_in
,
'
rb
'
)
fout
=
open
(
self
.
filenames
,
filemode
)
fields
=
0
...
...
@@ -303,6 +309,9 @@ class GribUtil(object):
iid: :obj:`integer`
Grib index id.
'''
from
eccodes
import
(
codes_index_read
,
codes_index_new_from_file
,
codes_index_add_file
,
codes_index_write
)
print
(
"
... index will be done
"
)
iid
=
None
...
...
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