Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
IPSL
E
ESPRI
ESPRI-Mod
catalog
Commits
9f212c60
Commit
9f212c60
authored
Feb 02, 2022
by
Guillaume
Browse files
Bugfixes
parent
ea909ff9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
32 deletions
+10
-32
ESMCollectionTemplate.json
ESMCollectionTemplate.json
+2
-24
constants.py
constants.py
+3
-3
esm_cat_generator.py
esm_cat_generator.py
+1
-1
utils.py
utils.py
+4
-4
No files found.
ESMCollectionTemplate.json
View file @
9f212c60
...
...
@@ -23,7 +23,7 @@
"table_id"
,
"grid_label"
],
"aggregations"
:
[
[{
%
for
agg
in
aggregations
%
}
"aggregations"
:
[{
%
for
agg
in
aggregations
%
}
{
"type"
:
"{{ agg.type }}"
,
"attribute_name"
:
"{{ agg.attribute_name }}"
,
...
...
@@ -31,28 +31,6 @@
"options"
:
"{{ agg.options }}"
{
%
endif
%
}
}{
%
if
not
loop.last
%
},{
%
endif
%
}
{
%
endfor
%
}],
{
"type"
:
"union"
,
"attribute_name"
:
"variable_id"
},
{
"type"
:
"join_existing"
,
"attribute_name"
:
"period_start"
,
"options"
:
{
"dim"
:
"time"
,
"coords"
:
"minimal"
,
"compat"
:
"override"
}
},
{
"type"
:
"join_new"
,
"attribute_name"
:
"member_id"
,
"options"
:
{
"coords"
:
"minimal"
,
"compat"
:
"override"
}
},
{
"type"
:
"join_new"
,
"attribute_name"
:
"init_year"
,
"options"
:
{
"coords"
:
"minimal"
,
"compat"
:
"override"
}
}
]
{
%
endfor
%
}]
}
}
constants.py
View file @
9f212c60
...
...
@@ -6,9 +6,9 @@
"""
CATALOG_OUTPUT_BACKUP
=
'/modfs/backup/catalog'
CATALOG_OUTPUT_PROD
=
'/modfs/catalog/catalog'
CATALOG_OUTPUT
=
'/modfs/scratch/catalog'
CATALOG_OUTPUT_BACKUP
=
'/modfs/backup/catalog
s
'
CATALOG_OUTPUT_PROD
=
'/modfs/catalog/catalog
s
'
CATALOG_OUTPUT
=
'/modfs/scratch/catalog
s
'
IPSL_DATA_ROOT
=
'/bdd/'
...
...
esm_cat_generator.py
View file @
9f212c60
...
...
@@ -239,7 +239,7 @@ def main():
_
=
[
x
for
x
in
processes
]
# Write JSON catalog.
make_json
(
CATALOG_OUTPUT_PROD
+
JSON_EXTENSION
,
args
.
project
,
header
)
make_json
(
CATALOG_OUTPUT_PROD
,
args
.
project
,
header
)
# Concatenate CSV files into one compressed CSV catalog.
print
(
f
'Concatenating CSV catalogs...'
)
...
...
utils.py
View file @
9f212c60
...
...
@@ -28,7 +28,7 @@ def make_csv(catpath, entries):
f
.
write
(
','
.
join
(
line
)
+
'
\n
'
)
def
make_json
(
cat
path
,
project
,
header
):
def
make_json
(
cat
dir
,
project
,
header
):
"""
ESM JSON catalog templating based on Jinja2.
...
...
@@ -36,7 +36,7 @@ def make_json(catpath, project, header):
print
(
f
'Writing JSON catalog...'
)
# Get catalog name.
cat
name
=
os
.
path
.
basename
(
catpath
)
cat
path
=
os
.
path
.
join
(
catdir
,
f
'
{
project
}{
JSON_EXTENSION
}
'
)
# Load Jinja2 template for ESM catalogs.
with
open
(
'ESMCollectionTemplate.json'
)
as
file
:
...
...
@@ -45,9 +45,9 @@ def make_json(catpath, project, header):
# Set template content.
content
=
dict
()
content
[
'esmcat_version'
]
=
'0.1.0'
content
[
'id'
]
=
os
.
path
.
splitext
(
cat
name
)[
0
]
content
[
'id'
]
=
os
.
path
.
splitext
(
cat
path
)[
0
]
content
[
'description'
]
=
CATALOG_DESCRIPTION_TEMPLATE
.
format
(
project
)
content
[
'catalog_file'
]
=
os
.
path
.
splitext
(
cat
name
)[
0
]
+
CSV_EXTENSION
content
[
'catalog_file'
]
=
os
.
path
.
splitext
(
cat
path
)[
0
]
+
CSV_EXTENSION
content
[
'attributes'
]
=
list
()
for
facet
in
header
[
2
:]:
attr
=
dict
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment