Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Oceano2python
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
US191
Oceano2python
Commits
2d5c5dbf
Commit
2d5c5dbf
authored
5 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
remove returnCode
parent
06940dab
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
netcdf.py
+4
-3
4 additions, 3 deletions
netcdf.py
oceano.py
+2
-2
2 additions, 2 deletions
oceano.py
physicalParameter.py
+2
-5
2 additions, 5 deletions
physicalParameter.py
with
8 additions
and
10 deletions
netcdf.py
+
4
−
3
View file @
2d5c5dbf
...
...
@@ -17,7 +17,7 @@ def writeNetCDF(fileName, fe):
# create netcdf file
nc
=
Dataset
(
fileName
,
"
w
"
,
format
=
"
NETCDF3_CLASSIC
"
)
logging
.
debug
(
'
'
+
nc
.
data_model
)
print
(
'
writing netCDF file: {}
'
.
format
(
fileName
))
# create dimensions
# n is number of profiles, m the max size of profiles
time
=
nc
.
createDimension
(
"
TIME
"
,
fe
.
n
)
...
...
@@ -35,8 +35,8 @@ def writeNetCDF(fileName, fe):
variables
.
append
(
k
)
# variables.extend(fe.keys())
for
key
in
variables
:
# for each variables get the attributes
list
hash
=
r
.
returnCode
(
key
)
# for each variables get the attributes
dictionary from Roscop
hash
=
r
[
key
]
# _FillValue attribute must be set when variable is created
# (using fill_value keyword to createVariable)
if
'
_FillValue
'
in
hash
:
...
...
@@ -73,3 +73,4 @@ def writeNetCDF(fileName, fe):
# close the netcdf file
nc
.
close
()
print
(
'
done...
'
)
This diff is collapsed.
Click to expand it.
oceano.py
+
2
−
2
View file @
2d5c5dbf
...
...
@@ -265,6 +265,6 @@ if __name__ == "__main__":
keys
=
cfg
[
'
split
'
][
device
.
lower
()].
keys
()
# in command line mode (console)
fe
=
process
(
args
,
cfg
,
device
)
print
(
"
Dimensions: {} x {}
"
.
format
(
fe
.
m
,
fe
.
n
))
print
(
fe
.
disp
())
#
print("Dimensions: {} x {}".format(fe.m, fe.n))
#
print(fe.disp())
netcdf
.
writeNetCDF
(
'
output/test.nc
'
,
fe
)
This diff is collapsed.
Click to expand it.
physicalParameter.py
+
2
−
5
View file @
2d5c5dbf
...
...
@@ -27,7 +27,8 @@ class Roscop:
return
'
Class Roscop, file: %s, size = %d
'
%
(
self
.
file
,
len
(
self
))
def
__getitem__
(
self
,
key
):
'''
overload r[key]
'''
'''
overload r[key]
for a given key return the values as a dictionary
'''
if
key
not
in
self
.
__hash
:
logging
.
error
(
"
Invalid key:
\"
{}
\"
"
.
format
(
key
))
...
...
@@ -61,10 +62,6 @@ class Roscop:
print
(
"
%s :
"
%
key
)
print
(
self
[
key
])
def
returnCode
(
self
,
key
):
'''
for a given key return the values as a dictionary
'''
return
(
self
[
key
])
# read code roscop file
def
read
(
self
):
with
open
(
self
.
file
,
'
rt
'
)
as
f
:
...
...
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