Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VERIFY
CIF
Commits
4e419284
Commit
4e419284
authored
Jan 14, 2022
by
Antoine Berchet
Browse files
CAMS working for interpolation
parent
8d625035
Changes
3
Hide whitespace changes
Inline
Side-by-side
pycif/plugins/datastreams/fields/netcdf_cams/__init__.py
View file @
4e419284
...
...
@@ -15,8 +15,9 @@ _fullname = "CAMS netcdf files"
input_arguments
=
{
"aibi_name"
:
{
"doc"
:
"to choose ai bi vertical coordinate names"
" instead of hyam and hybm"
,
"doc"
:
"To choose ai/bi vertical coordinate names"
" instead of hyam and hybm; this depends on the version of the CAMS "
"product to be read"
,
"default"
:
False
,
"accepted"
:
bool
},
...
...
pycif/plugins/datastreams/fields/netcdf_cams/get_domain.py
View file @
4e419284
...
...
@@ -6,6 +6,7 @@ import xarray as xr
from
.....utils.classes.setup
import
Setup
import
copy
def
get_domain
(
ref_dir
,
ref_file
,
input_dates
,
target_dir
,
tracer
=
None
):
# Looking for a reference file to read lon/lat in
...
...
@@ -67,6 +68,7 @@ def get_domain(ref_dir, ref_file, input_dates, target_dir, tracer=None):
else
:
sigma_a
=
nc
[
"hyam"
].
values
sigma_b
=
nc
[
"hybm"
].
values
nlevs
=
sigma_a
.
size
# Initializes domain
...
...
pycif/plugins/datastreams/fields/netcdf_cams/read.py
View file @
4e419284
...
...
@@ -31,16 +31,16 @@ def read(
comp_type: type of boundary conditions to generate
"""
if
ddi
is
None
:
raise
Exception
(
"CAMS netCDF read function was called "
"without specifying ddi"
)
# Variable name to extract
var2extract
=
name
if
varnames
!=
""
:
var2extract
=
varnames
# Reading fields for periods within the simulation window
xout
=
[]
opened_file
=
""
...
...
@@ -49,7 +49,7 @@ def read(
if
dd_file
!=
opened_file
:
ds
=
xr
.
open_dataset
(
dd_file
)
opened_file
=
dd_file
ntimes
=
ds
.
dims
[
"time"
]
freq
=
pd
.
DatetimeIndex
([
dd
[
0
]]).
days_in_month
[
0
]
*
24
/
ntimes
...
...
@@ -59,13 +59,13 @@ def read(
lat
=
ds
[
'latitude'
]
conc
=
ds
[
var2extract
].
values
[
date_index
]
if
lat
[
1
]
<
lat
[
0
]
and
conc
.
ndim
==
4
:
if
lat
[
1
]
<
lat
[
0
]
and
conc
.
ndim
==
4
:
conc
=
conc
[:,
:,
::
-
1
,
:]
elif
lat
[
1
]
<
lat
[
0
]
and
conc
.
ndim
==
3
:
conc
=
conc
[
:,
::
-
1
,
:]
elif
lat
[
1
]
<
lat
[
0
]
and
conc
.
ndim
==
3
:
conc
=
conc
[:,
::
-
1
,
:]
xout
.
append
(
conc
)
xmod
=
xr
.
DataArray
(
np
.
array
(
xout
),
coords
=
{
"time"
:
np
.
array
(
dates
)[:,
0
]},
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment