Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
webgeodyn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Geodynamo
webgeodyn
Commits
1ae19ad0
Commit
1ae19ad0
authored
1 year ago
by
Francois Dall'Asta
Browse files
Options
Downloads
Patches
Plain Diff
updated obs_data file to read 12M data
parent
2462f85f
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
webgeodyn/obsdata/obsdata.py
+9
-13
9 additions, 13 deletions
webgeodyn/obsdata/obsdata.py
with
9 additions
and
13 deletions
webgeodyn/obsdata/obsdata.py
+
9
−
13
View file @
1ae19ad0
...
@@ -84,21 +84,19 @@ class ObsData:
...
@@ -84,21 +84,19 @@ class ObsData:
def
find_cdf_files
(
self
,
path
):
def
find_cdf_files
(
self
,
path
):
"""
"""
find all files with .cdf extension in path directory and
find all files with .cdf extension in path directory and
returns the list
of 4-month data and
the 1-month data.
returns the list the 1
2
-month data.
"""
"""
brut_files_1
M
,
brut_files_4M
=
[],
[]
brut_files_1
2M
=
[]
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
path
):
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
path
):
for
filename
in
[
f
for
f
in
filenames
if
f
.
endswith
(
"
.cdf
"
)]:
for
filename
in
[
f
for
f
in
filenames
if
f
.
endswith
(
"
.cdf
"
)]:
name
=
os
.
path
.
join
(
dirpath
,
filename
)
name
=
os
.
path
.
join
(
dirpath
,
filename
)
if
'
4M
'
in
filename
:
if
'
12M
'
in
filename
:
brut_files_4M
.
append
(
name
)
brut_files_12M
.
append
(
name
)
elif
'
1M
'
in
filename
:
brut_files_1M
.
append
(
name
)
else
:
else
:
print
(
'
file {} do not match requirements
'
.
format
(
filename
))
print
(
'
file {} do not match requirements
'
.
format
(
filename
))
return
brut_files_1
M
,
brut_files_4
M
return
brut_files_1
2
M
def
loadFromDirectory
(
self
,
dataDirectory
,
cdf_type
=
'
4
M
'
):
def
loadFromDirectory
(
self
,
dataDirectory
,
cdf_type
=
'
12
M
'
):
"""
"""
Reads VO files into CHAMP, SWARM, GO and other satellites files in Magnetic ObservatoryGroups.
Reads VO files into CHAMP, SWARM, GO and other satellites files in Magnetic ObservatoryGroups.
...
@@ -110,15 +108,13 @@ class ObsData:
...
@@ -110,15 +108,13 @@ class ObsData:
cdf_name_shortcuts
=
[
'
GO
'
,
'
CH
'
,
'
SW
'
,
'
OR
'
,
'
CR
'
,
'
CO
'
]
cdf_name_shortcuts
=
[
'
GO
'
,
'
CH
'
,
'
SW
'
,
'
OR
'
,
'
CR
'
,
'
CO
'
]
# find all cdf filenames in data directory
# find all cdf filenames in data directory
cdf_files_1
M
,
cdf_files_4
M
=
self
.
find_cdf_files
(
dataDirectory
)
cdf_files_1
2
M
=
self
.
find_cdf_files
(
dataDirectory
)
for
obsGroupName
,
cdf_shortcut
in
zip
(
possible_ids
,
cdf_name_shortcuts
):
for
obsGroupName
,
cdf_shortcut
in
zip
(
possible_ids
,
cdf_name_shortcuts
):
GO
=
True
if
obsGroupName
==
'
GROUND
'
else
False
GO
=
True
if
obsGroupName
==
'
GROUND
'
else
False
if
cdf_type
==
'
4M
'
:
if
cdf_type
==
'
12M
'
:
cdf_files
=
cdf_files_4M
cdf_files
=
cdf_files_12M
elif
cdf_type
==
'
1M
'
:
cdf_files
=
cdf_files_1M
else
:
else
:
raise
ValueError
(
'
cdf_type {} not recognized
'
.
format
(
cdf_type
))
raise
ValueError
(
'
cdf_type {} not recognized
'
.
format
(
cdf_type
))
# extract file that starts with the cdf name shortcut, i.e. GO, CH, SW....
# extract file that starts with the cdf name shortcut, i.e. GO, CH, SW....
...
...
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