Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scm-io
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
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
inmcm-mirror
scm-io
Commits
53e38765
Commit
53e38765
authored
8 months ago
by
Debolskiy Andrey
Browse files
Options
Downloads
Patches
Plain Diff
added Ramil io module
parent
6f7d776e
No related branches found
No related tags found
No related merge requests found
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.idea/misc.xml
+3
-0
3 additions, 0 deletions
.idea/misc.xml
CMakeLists.txt
+4
-5
4 additions, 5 deletions
CMakeLists.txt
src/io.f90
+3389
-0
3389 additions, 0 deletions
src/io.f90
src/netcdf_io_module.f90
+0
-211
0 additions, 211 deletions
src/netcdf_io_module.f90
with
3396 additions
and
216 deletions
.idea/misc.xml
+
3
−
0
View file @
53e38765
...
...
@@ -3,6 +3,9 @@
<component
name=
"Black"
>
<option
name=
"sdkName"
value=
"Python 3.8 (untitled)"
/>
</component>
<component
name=
"CMakePythonSetting"
>
<option
name=
"pythonIntegrationState"
value=
"YES"
/>
</component>
<component
name=
"CMakeWorkspace"
PROJECT_DIR=
"$PROJECT_DIR$"
/>
<component
name=
"JsBuildToolPackageJson"
sorting=
"DEFINITION_ORDER"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.8 (untitled)"
project-jdk-type=
"Python SDK"
/>
...
...
This diff is collapsed.
Click to expand it.
CMakeLists.txt
+
4
−
5
View file @
53e38765
...
...
@@ -16,13 +16,12 @@ set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${dialect}")
include_directories
(
src
)
set
(
plt
_io
set
(
src
_io
src/scm_io_plt.f90
#src/test_io_plt.f90
src/netcdf_io_module.f90
)
#src/test_netcdf.f90)
src/io.f90
)
add_library
(
test_io
${
plt_io
}
)
add_library
(
test_io
${
src_io
}
)
target_include_directories
(
test_io PRIVATE
${
netCDF_INCLUDE_DIR
}
)
...
...
This diff is collapsed.
Click to expand it.
src/io.f90
0 → 100644
+
3389
−
0
View file @
53e38765
This diff is collapsed.
Click to expand it.
src/netcdf_io_module.f90
deleted
100644 → 0
+
0
−
211
View file @
6f7d776e
module
netcdf_io_module
use
netcdf
implicit
none
type
::
io_struct
integer
::
ncid
integer
::
time_dimid
,
height_dimid
,
lat_dimid
,
lon_dimid
integer
::
varid_time
,
varid_series
,
varid_timescan
,
varid_profile
integer
::
varid_2Dtime
,
varid_3Dtime
,
varid_2D
,
varid_3D
logical
::
is_open
=
.false.
character
(
len
=
128
)
::
series_name
=
'timeseries of variable'
character
(
len
=
128
)
::
series_long_name
=
'timeseries of some variable'
character
(
len
=
128
)
::
series_units
=
'unit'
character
(
len
=
128
)
::
timescan_name
=
'vertical timescan of variable'
character
(
len
=
128
)
::
timescan_long_name
=
'vertical timescan of some variable'
character
(
len
=
128
)
::
timescan_units
=
'unit'
character
(
len
=
128
)
::
profile_name
=
'vertical profile of variable'
character
(
len
=
128
)
::
profile_long_name
=
'vertical profile of some variable'
character
(
len
=
128
)
::
profile_units
=
'unit'
character
(
len
=
128
)
::
d2time_name
=
'2D variable with time'
character
(
len
=
128
)
::
d2time_long_name
=
'2D variable with time'
character
(
len
=
128
)
::
d2time_units
=
'unit'
character
(
len
=
128
)
::
d3time_name
=
'3D variable with time'
character
(
len
=
128
)
::
d3time_long_name
=
'3D variable with time'
character
(
len
=
128
)
::
d3time_units
=
'unit'
character
(
len
=
128
)
::
d2_name
=
'2D variable'
character
(
len
=
128
)
::
d2_long_name
=
'2D variable'
character
(
len
=
128
)
::
d2_units
=
'unit'
character
(
len
=
128
)
::
d3_name
=
'3D variable'
character
(
len
=
128
)
::
d3_long_name
=
'3D variable'
character
(
len
=
128
)
::
d3_units
=
'unit'
end
type
io_struct
contains
subroutine
open_netcdf
(
filename
,
ios
,
time_len
,
height_len
,
lat_len
,
lon_len
)
character
(
len
=*
),
intent
(
in
)
::
filename
type
(
io_struct
),
intent
(
out
)
::
ios
integer
,
intent
(
in
)
::
time_len
,
height_len
,
lat_len
,
lon_len
integer
::
ierr
ierr
=
nf90_create
(
filename
,
nf90_clobber
,
ios
%
ncid
)
if
(
ierr
==
nf90_noerr
)
then
ios
%
is_open
=
.true.
ierr
=
nf90_def_dim
(
ios
%
ncid
,
'time'
,
time_len
,
ios
%
time_dimid
)
ierr
=
nf90_def_dim
(
ios
%
ncid
,
'height'
,
height_len
,
ios
%
height_dimid
)
ierr
=
nf90_def_dim
(
ios
%
ncid
,
'lat'
,
lat_len
,
ios
%
lat_dimid
)
ierr
=
nf90_def_dim
(
ios
%
ncid
,
'lon'
,
lon_len
,
ios
%
lon_dimid
)
ierr
=
nf90_def_var
(
ios
%
ncid
,
'time'
,
nf90_float
,
ios
%
time_dimid
,
ios
%
varid_time
)
ierr
=
nf90_def_var
(
ios
%
ncid
,
'series'
,
nf90_float
,
ios
%
time_dimid
,
ios
%
varid_series
)
ierr
=
nf90_def_var
(
ios
%
ncid
,
'timescan'
,
nf90_float
,
&
[
ios
%
time_dimid
,
ios
%
height_dimid
],
ios
%
varid_timescan
)
ierr
=
nf90_def_var
(
ios
%
ncid
,
'profile'
,
nf90_float
,
ios
%
height_dimid
,
ios
%
varid_profile
)
ierr
=
nf90_def_var
(
ios
%
ncid
,
'2Dtime'
,
nf90_float
,
&
[
ios
%
time_dimid
,
ios
%
lat_dimid
,
ios
%
lon_dimid
],
ios
%
varid_2Dtime
)
ierr
=
nf90_def_var
(
ios
%
ncid
,
'3Dtime'
,
nf90_float
,
&
[
ios
%
time_dimid
,
ios
%
lat_dimid
,
ios
%
lon_dimid
,
ios
%
height_dimid
],
ios
%
varid_3Dtime
)
ierr
=
nf90_def_var
(
ios
%
ncid
,
'2D'
,
nf90_float
,
&
[
ios
%
lat_dimid
,
ios
%
lon_dimid
],
ios
%
varid_2D
)
ierr
=
nf90_def_var
(
ios
%
ncid
,
'3D'
,
nf90_float
,
&
[
ios
%
lat_dimid
,
ios
%
lon_dimid
,
ios
%
height_dimid
],
ios
%
varid_3D
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_series
,
'standard_name'
,
ios
%
series_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_series
,
'long_name'
,
ios
%
series_long_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_series
,
'units'
,
ios
%
series_units
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_timescan
,
'standard_name'
,
ios
%
timescan_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_timescan
,
'long_name'
,
ios
%
timescan_long_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_timescan
,
'units'
,
ios
%
timescan_units
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_profile
,
'standard_name'
,
ios
%
profile_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_profile
,
'long_name'
,
ios
%
profile_long_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_profile
,
'units'
,
ios
%
profile_units
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_2Dtime
,
'standard_name'
,
ios
%
d2time_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_2Dtime
,
'long_name'
,
ios
%
d2time_long_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_2Dtime
,
'units'
,
ios
%
d2time_units
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_3Dtime
,
'standard_name'
,
ios
%
d3time_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_3Dtime
,
'long_name'
,
ios
%
d3time_long_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_3Dtime
,
'units'
,
ios
%
d3time_units
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_2D
,
'standard_name'
,
ios
%
d2_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_2D
,
'long_name'
,
ios
%
d2_long_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_2D
,
'units'
,
ios
%
d2_units
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_3D
,
'standard_name'
,
ios
%
d3_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_3D
,
'long_name'
,
ios
%
d3_long_name
)
ierr
=
nf90_put_att
(
ios
%
ncid
,
ios
%
varid_3D
,
'units'
,
ios
%
d3_units
)
ierr
=
nf90_enddef
(
ios
%
ncid
)
else
print
*
,
'Error opening file: '
,
ierr
ios
%
is_open
=
.false.
endif
end
subroutine
open_netcdf
subroutine
write_series
(
ios
,
time_data
,
series_data
)
type
(
io_struct
),
intent
(
in
)
::
ios
real
,
dimension
(:),
intent
(
in
)
::
time_data
,
series_data
integer
::
ierr
if
(
.not.
ios
%
is_open
)
then
print
*
,
"File is not open."
return
endif
ierr
=
nf90_put_var
(
ios
%
ncid
,
ios
%
varid_time
,
time_data
)
ierr
=
nf90_put_var
(
ios
%
ncid
,
ios
%
varid_series
,
series_data
)
if
(
ierr
/
=
nf90_noerr
)
then
print
*
,
'Error writing series data:'
,
ierr
endif
end
subroutine
write_series
subroutine
write_timescan
(
ios
,
timescan_data
)
type
(
io_struct
),
intent
(
in
)
::
ios
real
,
dimension
(:,:),
intent
(
in
)
::
timescan_data
integer
::
ierr
if
(
.not.
ios
%
is_open
)
then
print
*
,
"File is not open."
return
endif
ierr
=
nf90_put_var
(
ios
%
ncid
,
ios
%
varid_timescan
,
timescan_data
)
if
(
ierr
/
=
nf90_noerr
)
then
print
*
,
'Error writing timescan data:'
,
ierr
endif
end
subroutine
write_timescan
subroutine
write_profile
(
ios
,
profile_data
)
type
(
io_struct
),
intent
(
in
)
::
ios
real
,
dimension
(:),
intent
(
in
)
::
profile_data
integer
::
ierr
if
(
.not.
ios
%
is_open
)
then
print
*
,
"File is not open."
return
endif
ierr
=
nf90_put_var
(
ios
%
ncid
,
ios
%
varid_profile
,
profile_data
)
if
(
ierr
/
=
nf90_noerr
)
then
print
*
,
'Error writing profile data:'
,
ierr
endif
end
subroutine
write_profile
subroutine
write_2Dtime
(
ios
,
d2time_data
)
type
(
io_struct
),
intent
(
in
)
::
ios
real
,
dimension
(:,:,:)
::
d2time_data
integer
::
ierr
if
(
.not.
ios
%
is_open
)
then
print
*
,
"File is not open."
return
endif
ierr
=
nf90_put_var
(
ios
%
ncid
,
ios
%
varid_2Dtime
,
d2time_data
)
if
(
ierr
/
=
nf90_noerr
)
then
print
*
,
'Error writing 2Dtime data:'
,
ierr
endif
end
subroutine
write_2Dtime
subroutine
write_3Dtime
(
ios
,
d3time_data
)
type
(
io_struct
),
intent
(
in
)
::
ios
real
,
dimension
(:,:,:,:)
::
d3time_data
integer
::
ierr
if
(
.not.
ios
%
is_open
)
then
print
*
,
"File is not open."
return
endif
ierr
=
nf90_put_var
(
ios
%
ncid
,
ios
%
varid_3Dtime
,
d3time_data
)
if
(
ierr
/
=
nf90_noerr
)
then
print
*
,
"Error writing 3Dtime data:"
,
ierr
endif
end
subroutine
write_3Dtime
subroutine
write_2D
(
ios
,
d2_data
)
type
(
io_struct
),
intent
(
in
)
::
ios
real
,
dimension
(:,:)
::
d2_data
integer
::
ierr
if
(
.not.
ios
%
is_open
)
then
print
*
,
"File is not open."
return
endif
ierr
=
nf90_put_var
(
ios
%
ncid
,
ios
%
varid_2D
,
d2_data
)
if
(
ierr
/
=
nf90_noerr
)
then
print
*
,
'Error writing 2D data:'
,
ierr
endif
end
subroutine
write_2D
subroutine
write_3D
(
ios
,
d3_data
)
type
(
io_struct
),
intent
(
in
)
::
ios
real
,
dimension
(:,:,:)
::
d3_data
integer
::
ierr
if
(
.not.
ios
%
is_open
)
then
print
*
,
"File is not open."
return
endif
ierr
=
nf90_put_var
(
ios
%
ncid
,
ios
%
varid_3D
,
d3_data
)
if
(
ierr
/
=
nf90_noerr
)
then
print
*
,
'Error writing 3D data:'
,
ierr
endif
end
subroutine
write_3D
subroutine
close_netcdf
(
ios
)
type
(
io_struct
),
intent
(
inout
)
::
ios
integer
::
ierr
ierr
=
nf90_close
(
ios
%
ncid
)
ios
%
is_open
=
.false.
end
subroutine
close_netcdf
end
module
netcdf_io_module
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