Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autoicon
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
w2w
autoicon
Commits
90d852a4
Commit
90d852a4
authored
1 year ago
by
Oriol Tintó
Browse files
Options
Downloads
Patches
Plain Diff
Trying to convert the analysis to netcdf.
parent
f783572c
No related branches found
No related tags found
No related merge requests found
Pipeline
#19158
canceled
1 year ago
Stage: run_tests
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
templates/event-generator/adapt_member_utils.sh
+54
-1
54 additions, 1 deletion
templates/event-generator/adapt_member_utils.sh
with
54 additions
and
1 deletion
templates/event-generator/adapt_member_utils.sh
+
54
−
1
View file @
90d852a4
...
...
@@ -111,6 +111,60 @@ END
}
function
integrate_sst_to_analysis
()
{
local
DYNAMICS_GRID_FILE
=
"
$1
"
local
ANALYSIS_FILE
=
"
$2
"
echo
"Converting analysis to netcdf"
cat
>
remap.nml
<<
END
&remap_nml
in_filename = "
${
ANALYSIS_FILE
}
"
in_grid_filename = "
${
DYNAMICS_GRID_FILE
}
"
in_type = 1
out_grid_filename = "
${
DYNAMICS_GRID_FILE
}
"
out_filename = "analysis.nc"
out_type = 2
out_filetype = 4
/
END
cat
<<
END
>extend_remap_namelist.py
import xarray as xr
with xr.open_dataset("
${
ANALYSIS_FILE
}
") as ds, open('remap.nml', 'a') as file:
for ida, da in enumerate(ds):
file.write('&input_field_nml
\n
')
file.write(f'inputname = "{da}"
\n
')
file.write(f'outputname = "{da}"
\n
')
file.write('/
\n\n
')
END
python3 extend_remap_namelist.py
ulimit
-s
unlimited
OMP_NUM_THREADS
=
1 iconremap
--remap_nml
remap.nml
#-vvv
rm
remap.nml
# # Somehow, when we interpolate we lose some attributes.
# # Here we solve this issue adding the attributes.
# cat <<END >add_attributes.py
## Add sst field to analysis file.
#from enstools.io import read
#
## Open files
#with read("tmp_extpar.nc") as ds, read("${EXTERNAL_PARAMETERS_FILE}") as original_extpar_ds:
# if "rawdata" in original_extpar_ds.attrs:
# ds.attrs["rawdata"] = original_extpar_ds.attrs["rawdata"]
# ds.to_netcdf("extpar.nc")
#END
# python3 add_attributes.py
#
# rm "tmp_extpar.nc"
}
function
old_integrate_sst_to_analysis
()
{
local
INTERPOLATED_SST
=
"
$1
"
local
ANALYSIS_FILE
=
"
$2
"
...
...
@@ -171,4 +225,3 @@ END
python integrate_sst_to_extpar.py
}
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