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
38c48d2c
Commit
38c48d2c
authored
3 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
add global attributes
parent
d0b11692
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
netcdf.py
+18
-0
18 additions, 0 deletions
netcdf.py
with
18 additions
and
0 deletions
netcdf.py
+
18
−
0
View file @
38c48d2c
...
@@ -2,6 +2,7 @@ import logging
...
@@ -2,6 +2,7 @@ import logging
from
netCDF4
import
Dataset
from
netCDF4
import
Dataset
from
numpy
import
arange
,
dtype
from
numpy
import
arange
,
dtype
import
os
import
os
from
datetime
import
datetime
def
writeNetCDF
(
cfg
,
device
,
fe
,
r
,
variables_1D
):
def
writeNetCDF
(
cfg
,
device
,
fe
,
r
,
variables_1D
):
...
@@ -71,6 +72,23 @@ def writeNetCDF(cfg, device, fe, r, variables_1D):
...
@@ -71,6 +72,23 @@ def writeNetCDF(cfg, device, fe, r, variables_1D):
setattr
(
ncvars
[
key
],
k
,
hash
[
k
])
setattr
(
ncvars
[
key
],
k
,
hash
[
k
])
nc
.
_enddef
()
nc
.
_enddef
()
# add global attributes
nc
.
data_type
=
"
OceanSITES profile data
"
nc
.
Conventions
=
"
CF-1.8
"
nc
.
cycle_mesure
=
cfg
[
'
cruise
'
][
'
cycleMesure
'
]
nc
.
time_coverage_start
=
cfg
[
'
cruise
'
][
'
beginDate
'
]
nc
.
time_coverage_end
=
cfg
[
'
cruise
'
][
'
endDate
'
]
nc
.
timezone
=
cfg
[
'
cruise
'
][
'
timezone
'
]
nc
.
data_assembly_center
=
cfg
[
'
cruise
'
][
'
institute
'
]
nc
.
type_instrument
=
cfg
[
device
.
lower
()][
'
typeInstrument
'
]
nc
.
instrument_number
=
cfg
[
device
.
lower
()][
'
instrumentNumber
'
]
nc
.
date_update
=
datetime
.
today
().
strftime
(
'
%Y-%m-%dT%H:%M:%SZ
'
)
nc
.
pi_name
=
cfg
[
'
cruise
'
][
'
pi
'
]
nc
.
processing_state
=
"
1A
"
nc
.
codification
=
"
OOPC
"
nc
.
format_version
=
"
1.2
"
nc
.
Netcdf_version
=
"
3.6
"
# debug
# debug
for
key
in
variables
:
for
key
in
variables
:
logging
.
debug
(
"
var: {}, dims: {}, shape: {}, dtype: {}, ndim: {}
"
.
format
(
logging
.
debug
(
"
var: {}, dims: {}, shape: {}, dtype: {}, ndim: {}
"
.
format
(
...
...
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