Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Detection eddies
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
IPSL
LMD
DPAO
Detection eddies
Commits
0b15191a
Commit
0b15191a
authored
5 months ago
by
GUEZ Lionel
Browse files
Options
Downloads
Patches
Plain Diff
Allow reading from files with multiple time steps
parent
11677eee
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Inst_eddies/input_ssh.f90
+28
-6
28 additions, 6 deletions
Inst_eddies/input_ssh.f90
with
28 additions
and
6 deletions
Inst_eddies/input_ssh.f90
+
28
−
6
View file @
0b15191a
...
...
@@ -61,6 +61,13 @@ contains
integer
unit
integer
ncid
,
dimid
,
varid
integer
::
nc_time
=
1
! Index, 1-based, in the NetCDF time coordinate, if any, of the
! time slice to read. If there is no time coordinate, then leave
! nc_time to its default 1 value. If there is a time coordinate
! then we assume that the dimensions of the ssh, u and v NetCDF
! variables are longitude, latitude and time, in Fortran order.
real
::
corner_deg
(
2
)
=
huge
(
0.
)
! longitude and latitude of the corner of the whole grid, in degrees
...
...
@@ -69,7 +76,7 @@ contains
integer
copy
namelist
/
grid_nml
/
corner_deg
,
step_deg
,
nlon
,
nlat
,
periodic
,
&
uniform_lon_lat
namelist
/
input_ssh_nml
/
periodic
,
uniform_lon_lat
namelist
/
input_ssh_nml
/
periodic
,
uniform_lon_lat
,
nc_time
!----------------------------------------------------------------------
...
...
@@ -121,7 +128,7 @@ contains
! Read ssh, u and v:
call
get_var
(
periodic
,
ssh
,
ncid
,
name
=
"adt"
,
&
call
get_var
(
periodic
,
ssh
,
ncid
,
nc_time
,
name
=
"adt"
,
&
new_fill_value
=
huge
(
0.
))
! (We cannot keep the original fill value because Contour_531
! works with an upper limit for valid values.)
...
...
@@ -131,7 +138,7 @@ contains
call
nf95_open
(
u_fname
,
nf95_nowrite
,
ncid
)
end
if
call
get_var
(
periodic
,
u
,
ncid
,
name
=
"ugos"
,
&
call
get_var
(
periodic
,
u
,
ncid
,
nc_time
,
name
=
"ugos"
,
&
new_fill_value
=
ieee_value
(
0.
,
IEEE_QUIET_NAN
))
if
(
v_fname
/
=
u_fname
)
then
...
...
@@ -139,7 +146,7 @@ contains
call
nf95_open
(
v_fname
,
nf95_nowrite
,
ncid
)
end
if
call
get_var
(
periodic
,
v
,
ncid
,
name
=
"vgos"
,
&
call
get_var
(
periodic
,
v
,
ncid
,
nc_time
,
name
=
"vgos"
,
&
new_fill_value
=
ieee_value
(
0.
,
IEEE_QUIET_NAN
))
! (We will need quiet NaNs rather the original fill values for u and
! v when we compute the max-speed contours and when we search the
...
...
@@ -150,7 +157,7 @@ contains
!*********************************************************************
subroutine
get_var
(
periodic
,
values
,
ncid
,
name
,
new_fill_value
)
subroutine
get_var
(
periodic
,
values
,
ncid
,
nc_time
,
name
,
new_fill_value
)
! Read a NetCDF variable, change the missing value and extend it
! in longitude if periodic.
...
...
@@ -169,6 +176,14 @@ contains
! declaration references periodic.
integer
,
intent
(
in
)::
ncid
integer
,
intent
(
in
)::
nc_time
! Index, 1-based, in the NetCDF time coordinate, if any, of the
! time slice to read. If there is no time coordinate, then nc_time
! should be equal to 1. If there is a time coordinate then we
! assume that the dimension of the NetCDF variable to read are
! longitude, latitude and time, in Fortran order.
character
(
len
=
*
),
intent
(
in
)::
name
! of NetCDF variable
real
,
intent
(
in
)::
new_fill_value
...
...
@@ -179,7 +194,14 @@ contains
!-------------------------------------------------------------------------
call
nf95_inq_varid
(
ncid
,
name
,
varid
)
call
nf95_get_var
(
ncid
,
varid
,
values
(
1
:
nlon
,
:))
if
(
nc_time
==
1
)
then
call
nf95_get_var
(
ncid
,
varid
,
values
(
1
:
nlon
,
:))
else
call
nf95_get_var
(
ncid
,
varid
,
values
(
1
:
nlon
,
:),
&
start
=
[
1
,
1
,
nc_time
])
end
if
call
nf95_get_missing
(
ncid
,
varid
,
Fill_Value
)
! Change the missing value:
...
...
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