@@ -18,9 +18,9 @@ subroutine read_other_NetCDF(file, vari, itime, model_2Darray, check_dummy, do_o
1818 USE MOD_MESH
1919 USE MOD_PARTIT
2020 USE MOD_PARSUP
21+ use netcdf
2122 implicit none
2223
23- #include " netcdf.inc"
2424 type (t_mesh), intent (in ), target :: mesh
2525 type (t_partit), intent (inout ), target :: partit
2626 integer :: i, j, ii, jj, k, n, num, flag, cnt
@@ -46,11 +46,11 @@ subroutine read_other_NetCDF(file, vari, itime, model_2Darray, check_dummy, do_o
4646
4747 if (mype== 0 ) then
4848 ! open file
49- status= nf_open (file, nf_nowrite , ncid)
49+ status= nf90_open (file, nf90_nowrite , ncid)
5050 end if
5151
5252 call MPI_BCast(status, 1 , MPI_INTEGER, 0 , MPI_COMM_FESOM, ierror)
53- if (status.ne. nf_noerr )then
53+ if (status.ne. nf90_noerr )then
5454 print * ,' ERROR: CANNOT READ 2D netCDF FILE CORRECTLY !!!!!'
5555 print * ,' Error in opening netcdf file ' // file
5656 call par_ex(partit% MPI_COMM_FESOM, partit% mype)
@@ -59,28 +59,28 @@ subroutine read_other_NetCDF(file, vari, itime, model_2Darray, check_dummy, do_o
5959
6060 if (mype== 0 ) then
6161 ! lat
62- status= nf_inq_dimid (ncid, ' lat' , latid)
63- status= nf_inq_dimlen (ncid, latid, latlen)
62+ status= nf90_inq_dimid (ncid, ' lat' , latid)
63+ status= nf90_inquire_dimension (ncid, latid, len = latlen)
6464 ! lon
65- status= nf_inq_dimid (ncid, ' lon' , lonid)
66- status= nf_inq_dimlen (ncid, lonid, lonlen)
65+ status= nf90_inq_dimid (ncid, ' lon' , lonid)
66+ status= nf90_inquire_dimension (ncid, lonid, len = lonlen)
6767 end if
6868 call MPI_BCast(latlen, 1 , MPI_INTEGER, 0 , MPI_COMM_FESOM, ierror)
6969 call MPI_BCast(lonlen, 1 , MPI_INTEGER, 0 , MPI_COMM_FESOM, ierror)
7070
7171 ! lat
7272 allocate (lat(latlen))
7373 if (mype== 0 ) then
74- status= nf_inq_varid (ncid, ' lat' , varid)
75- status= nf_get_vara_double (ncid,varid,1 , latlen,lat )
74+ status= nf90_inq_varid (ncid, ' lat' , varid)
75+ status= nf90_get_var (ncid, varid, lat, start = ( / 1 / ), count = ( / latlen/ ) )
7676 end if
7777 call MPI_BCast(lat, latlen, MPI_DOUBLE_PRECISION, 0 , MPI_COMM_FESOM, ierror)
7878
7979 ! lon
8080 allocate (lon(lonlen))
8181 if (mype== 0 ) then
82- status= nf_inq_varid (ncid, ' lon' , varid)
83- status= nf_get_vara_double (ncid,varid,1 , lonlen,lon )
82+ status= nf90_inq_varid (ncid, ' lon' , varid)
83+ status= nf90_get_var (ncid, varid, lon, start = ( / 1 / ), count = ( / lonlen/ ) )
8484 end if
8585 call MPI_BCast(lon, lonlen, MPI_DOUBLE_PRECISION, 0 , MPI_COMM_FESOM, ierror)
8686
@@ -96,15 +96,15 @@ subroutine read_other_NetCDF(file, vari, itime, model_2Darray, check_dummy, do_o
9696
9797 if (mype== 0 ) then
9898 ! data
99- status= nf_inq_varid (ncid, vari, varid)
99+ status= nf90_inq_varid (ncid, vari, varid)
100100 istart = (/ 1 ,1 ,itime/ )
101101 icount= (/ lonlen,latlen,1 / )
102- status= nf_get_vara_double (ncid,varid,istart,icount,ncdata )
102+ status= nf90_get_var (ncid, varid, ncdata, start = istart, count = icount)
103103
104104 ! missing value
105- status= nf_get_att_double (ncid,varid,' missing_value' ,miss)
105+ status= nf90_get_att (ncid, varid, ' missing_value' , miss)
106106 ! close file
107- status= nf_close (ncid)
107+ status= nf90_close (ncid)
108108 end if
109109 call MPI_BCast(ncdata, lonlen* latlen, MPI_DOUBLE_PRECISION, 0 , MPI_COMM_FESOM, ierror)
110110 call MPI_BCast(miss, 1 , MPI_DOUBLE_PRECISION, 0 , MPI_COMM_FESOM, ierror)
@@ -199,8 +199,9 @@ subroutine read_surf_hydrography_NetCDF(file, vari, itime, model_2Darray, partit
199199 USE MOD_PARSUP
200200 use g_rotate_grid
201201 use , intrinsic :: ISO_FORTRAN_ENV, only: real64
202+ use netcdf
202203 implicit none
203- # include " netcdf.inc "
204+
204205 type (t_mesh), intent (in ), target :: mesh
205206 type (t_partit), intent (inout ), target :: partit
206207 integer :: i, j, n, num
@@ -225,11 +226,11 @@ subroutine read_surf_hydrography_NetCDF(file, vari, itime, model_2Darray, partit
225226
226227 if (mype== 0 ) then
227228 ! open file
228- status= nf_open (file, nf_nowrite , ncid)
229+ status= nf90_open (file, nf90_nowrite , ncid)
229230 end if
230231
231232 call MPI_BCast(status, 1 , MPI_INTEGER, 0 , MPI_COMM_FESOM, ierror)
232- if (status.ne. nf_noerr )then
233+ if (status.ne. nf90_noerr )then
233234 print * ,' ERROR: CANNOT READ runoff FILE CORRECTLY !!!!!'
234235 print * ,' Error in opening netcdf file ' // file
235236 call par_ex(partit% MPI_COMM_FESOM, partit% mype)
@@ -238,26 +239,26 @@ subroutine read_surf_hydrography_NetCDF(file, vari, itime, model_2Darray, partit
238239
239240 if (mype== 0 ) then
240241 ! lat
241- status= nf_inq_dimid (ncid, ' lat' , latid)
242- status= nf_inq_dimlen (ncid, latid, latlen)
242+ status= nf90_inq_dimid (ncid, ' lat' , latid)
243+ status= nf90_inquire_dimension (ncid, latid, len = latlen)
243244 ! lon
244- status= nf_inq_dimid (ncid, ' lon' , lonid)
245- status= nf_inq_dimlen (ncid, lonid, lonlen)
245+ status= nf90_inq_dimid (ncid, ' lon' , lonid)
246+ status= nf90_inquire_dimension (ncid, lonid, len = lonlen)
246247 end if
247248
248249 ! lat
249250 allocate (lat(latlen))
250251 if (mype== 0 ) then
251- status= nf_inq_varid (ncid, ' lat' , varid)
252- status= nf_get_vara_double (ncid,varid,1 , latlen,lat )
252+ status= nf90_inq_varid (ncid, ' lat' , varid)
253+ status= nf90_get_var (ncid, varid, lat, start = ( / 1 / ), count = ( / latlen/ ) )
253254 end if
254255 call MPI_BCast(lat, latlen, MPI_DOUBLE_PRECISION, 0 , MPI_COMM_FESOM, ierror)
255256
256257 ! lon
257258 allocate (lon(lonlen))
258259 if (mype== 0 ) then
259- status= nf_inq_varid (ncid, ' lon' , varid)
260- status= nf_get_vara_double (ncid,varid,1 , lonlen,lon )
260+ status= nf90_inq_varid (ncid, ' lon' , varid)
261+ status= nf90_get_var (ncid, varid, lon, start = ( / 1 / ), count = ( / lonlen/ ) )
261262 end if
262263 call MPI_BCast(lon, lonlen, MPI_DOUBLE_PRECISION, 0 , MPI_COMM_FESOM, ierror)
263264
@@ -273,17 +274,17 @@ subroutine read_surf_hydrography_NetCDF(file, vari, itime, model_2Darray, partit
273274 ncdata = 0.0_WP
274275
275276 if (mype== 0 ) then
276- status= nf_inq_varid (ncid, vari, varid)
277+ status= nf90_inq_varid (ncid, vari, varid)
277278 istart = (/ 1 ,1 ,1 ,itime/ )
278279 icount= (/ lonlen,latlen,1 ,1 / )
279- status= nf_get_vara_double (ncid,varid,istart,icount,ncdata )
280+ status= nf90_get_var (ncid, varid, ncdata, start = istart, count = icount)
280281
281282 ! missing value
282- status= nf_get_att_double (ncid,varid,' missing_value' ,miss)
283+ status= nf90_get_att (ncid, varid, ' missing_value' , miss)
283284 ! write(*,*)'miss', miss
284285 ! write(*,*)'raw',minval(ncdata),maxval(ncdata)
285286 ! close file
286- status= nf_close (ncid)
287+ status= nf90_close (ncid)
287288 end if
288289 call MPI_BCast(ncdata, lonlen* latlen, MPI_DOUBLE_PRECISION, 0 , MPI_COMM_FESOM, ierror)
289290 call MPI_BCast(miss, 1 , MPI_DOUBLE_PRECISION, 0 , MPI_COMM_FESOM, ierror)
@@ -321,9 +322,9 @@ subroutine read_2ddata_on_grid_NetCDF(file, vari, itime, model_2Darray, partit,
321322 USE MOD_PARTIT
322323 USE MOD_PARSUP
323324 use g_rotate_grid
325+ use netcdf
324326 implicit none
325327
326- #include " netcdf.inc"
327328 type (t_mesh), intent (in ) , target :: mesh
328329 type (t_partit), intent (inout ), target :: partit
329330 integer :: n, i
@@ -343,10 +344,10 @@ subroutine read_2ddata_on_grid_NetCDF(file, vari, itime, model_2Darray, partit,
343344
344345 if (mype== 0 ) then
345346 ! open file
346- status= nf_open (file, nf_nowrite , ncid)
347+ status= nf90_open (file, nf90_nowrite , ncid)
347348 end if
348349 call MPI_BCast(status, 1 , MPI_INTEGER, 0 , MPI_COMM_FESOM, ierror)
349- if (status.ne. nf_noerr )then
350+ if (status.ne. nf90_noerr )then
350351 print * ,' ERROR: CANNOT READ runoff FILE CORRECTLY !!!!!'
351352 print * ,' Error in opening netcdf file ' // file
352353 call par_ex(partit% MPI_COMM_FESOM, partit% mype)
@@ -355,11 +356,11 @@ subroutine read_2ddata_on_grid_NetCDF(file, vari, itime, model_2Darray, partit,
355356
356357 if (mype== 0 ) then
357358 ! get variables
358- status= nf_inq_varid (ncid, vari, varid)
359+ status= nf90_inq_varid (ncid, vari, varid)
359360 istart = (/ 1 , itime/ )
360361 icount= (/ nod2D, 1 / )
361- status= nf_get_vara_double (ncid,varid,istart,icount,ncdata )
362- status= nf_close (ncid)
362+ status= nf90_get_var (ncid, varid, ncdata, start = istart, count = icount)
363+ status= nf90_close (ncid)
363364 end if
364365 call MPI_BCast(ncdata, nod2D, MPI_DOUBLE_PRECISION, 0 , MPI_COMM_FESOM, ierror)
365366 model_2Darray= ncdata(myList_nod2D)
0 commit comments