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
7f671ee7
Commit
7f671ee7
authored
1 year ago
by
Oriol Tintó
Browse files
Options
Downloads
Patches
Plain Diff
Fix integrate_sst_to_analysis
parent
97012a1f
No related branches found
No related tags found
No related merge requests found
Pipeline
#19082
passed
1 year ago
Stage: run_tests
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
templates/event-generator/adapt_member.sh
+1
-1
1 addition, 1 deletion
templates/event-generator/adapt_member.sh
templates/event-generator/adapt_member_utils.sh
+4
-5
4 additions, 5 deletions
templates/event-generator/adapt_member_utils.sh
with
5 additions
and
6 deletions
templates/event-generator/adapt_member.sh
+
1
−
1
View file @
7f671ee7
...
...
@@ -10,7 +10,7 @@ WORKDIR=%HPCROOTDIR%
PROJ_FOLDER
=
${
WORKDIR
}
/production_project
SST_FORCING
=
$(
basename
%simulation.initial_conditions.sea_surface_temperature_forcing%
)
INTERPOLATED_SST
=
whatever
.nc
INTERPOLATED_SST
=
sst_climatology
.nc
DESTINATION_GRID
=
%simulation.dynamics_grid_filename%
EXTERNAL_PARAMETERS_FILE
=
%simulation.external_parameters_filename%
STARTDATE
=
%SDATE%
...
...
This diff is collapsed.
Click to expand it.
templates/event-generator/adapt_member_utils.sh
+
4
−
5
View file @
7f671ee7
...
...
@@ -99,18 +99,17 @@ function integrate_sst_to_analysis() {
cat
<<
END
> integrate_sst_to_analysis.py
# Add sst field to analysis file.
import xarray as xr
from enstools.io import read
import os
import numpy as np
os.environ['ECCODES_GRIB_NO_INDEX'] = '1'
# Open files
with
xr.open_dataset
("
${
ANALYSIS_FILE
}
") as ds,
xr.open_dataset
("
${
INTERPOLATED_SST
}
") as sst_ds:
with
read
("
${
ANALYSIS_FILE
}
") as ds,
read
("
${
INTERPOLATED_SST
}
") as sst_ds:
date=ds.time.values
day_of_year = int((date - np.datetime64(date.astype('datetime64[Y]'))) / np.timedelta64(1, 'D'))
day_of_year = int((date - date.astype('datetime64[Y]')) / np.timedelta64(1, 'D'))
# Replace analysis T_SEA with info from the sst_clim file.
ds["T_SEA"]= sst_ds.isel(time=day_of_year+1)
ds["T_SEA"]= sst_ds
["T_SEA"]
.isel(time=day_of_year+1)
ds.to_netcdf("analysis.nc")
END
...
...
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