diff --git a/Inst_eddies/CMakeLists.txt b/Inst_eddies/CMakeLists.txt index f9819468139549d7b0fcbbeacf058c6c43adc0d9..fff8c050fb1c74a22e09aa752084fa5ac0cc4807 100644 --- a/Inst_eddies/CMakeLists.txt +++ b/Inst_eddies/CMakeLists.txt @@ -1,9 +1,8 @@ # inst_eddies: add_executable(inst_eddies inst_eddies.f90 local_extrema.f90 set_max_speed.f90 get_1_outerm.f90 good_contour.f90 mean_speed.f90 set_contours.f90 - nearby_extr.f90 get_var.f90 config.f90 input_ssh.f90 shpc_create.f90 - write_snapshot.f90 ccw_orient.f90 write_eddy.f90 set_all_extr.f90 - complete_ssh.f90) + nearby_extr.f90 config.f90 input_ssh.f90 shpc_create.f90 write_snapshot.f90 + ccw_orient.f90 write_eddy.f90 set_all_extr.f90 complete_ssh.f90) target_link_libraries(inst_eddies PRIVATE Contour_531::contour_531 Geometry::geometry NetCDF95::netcdf95 Shapelib_03::shapelib_03 Numer_Rec_95::numer_rec_95 Jumble::jumble NetCDF_Fortran::netcdff) @@ -19,19 +18,17 @@ configure_file(inst_eddies_Aviso.py . COPYONLY FILE_PERMISSIONS # Tests: add_subdirectory(Tests) target_sources(test_get_1_outerm PRIVATE get_1_outerm.f90 good_contour.f90 - config.f90 input_ssh.f90 get_var.f90 shpc_create.f90 write_eddy.f90 - ccw_orient.f90) + config.f90 input_ssh.f90 shpc_create.f90 write_eddy.f90 ccw_orient.f90) target_sources(test_good_contour PRIVATE good_contour.f90) -target_sources(test_mean_speed PRIVATE mean_speed.f90 input_ssh.f90 get_var.f90 - config.f90) +target_sources(test_mean_speed PRIVATE mean_speed.f90 input_ssh.f90 config.f90) target_sources(test_nearby_extr PRIVATE nearby_extr.f90) target_sources(test_local_extrema PRIVATE local_extrema.f90) target_sources(test_set_max_speed PRIVATE set_max_speed.f90 good_contour.f90 - mean_speed.f90 get_var.f90 config.f90 input_ssh.f90 shpc_create.f90 - ccw_orient.f90 write_eddy.f90 complete_ssh.f90) + mean_speed.f90 config.f90 input_ssh.f90 shpc_create.f90 ccw_orient.f90 + write_eddy.f90 complete_ssh.f90) target_sources(test_write_null PRIVATE shpc_create.f90) target_sources(test_complete_ssh PRIVATE complete_ssh.f90) -target_sources(examine_eddy PRIVATE config.f90 input_ssh.f90 get_var.f90 - shpc_create.f90 set_all_extr.f90 local_extrema.f90 write_eddy.f90 - set_contours.f90 get_1_outerm.f90 ccw_orient.f90 good_contour.f90 - set_max_speed.f90 complete_ssh.f90 mean_speed.f90) +target_sources(examine_eddy PRIVATE config.f90 input_ssh.f90 shpc_create.f90 + set_all_extr.f90 local_extrema.f90 write_eddy.f90 set_contours.f90 + get_1_outerm.f90 ccw_orient.f90 good_contour.f90 set_max_speed.f90 + complete_ssh.f90 mean_speed.f90) diff --git a/Inst_eddies/get_var.f90 b/Inst_eddies/get_var.f90 deleted file mode 100644 index be5c7b7da9e7a4d57e7fa3ba7dc5d29d24ba5200..0000000000000000000000000000000000000000 --- a/Inst_eddies/get_var.f90 +++ /dev/null @@ -1,53 +0,0 @@ -module get_var_m - - implicit none - -contains - - subroutine get_var(periodic, max_rad_lon, values, ncid, nlon, name, & - new_fill_value) - - ! Read a NetCDF variable, change the missing value and extend it - ! in longitude if periodic. - - ! Libraries: - use netcdf95, only: nf95_inq_varid, nf95_get_var, nf95_get_missing - - logical, intent(in):: periodic ! grid is periodic in longitude - - integer, intent(in):: max_rad_lon ! maximum radius of an eddy in - ! longitude, in number of grid points, used only if periodic - - real, intent(out):: values(1 - merge(max_rad_lon, 0, periodic):, :) - ! (1 - merge(max_rad_lon, 0, periodic):nlon + merge(max_rad_lon, - ! 0, periodic), nlat) ssh, u or v. We cannot place this argument - ! first because the declaration references max_rad_lon and - ! periodic. - - integer, intent(in):: ncid, nlon - character(len = *), intent(in):: name ! of NetCDF variable - real, intent(in):: new_fill_value - - ! Local: - integer varid - real Fill_Value - - !------------------------------------------------------------------------- - - call nf95_inq_varid(ncid, name, varid) - call nf95_get_var(ncid, varid, values(1:nlon, :)) - call nf95_get_missing(ncid, varid, Fill_Value) - - ! Change the missing value: - where (values(1:nlon, :) == Fill_Value) values(1:nlon, :) = new_fill_value - - if (periodic) then - ! Extend in longitude: - values(1 - max_rad_lon:0, :) & - = values(nlon + 1 - max_rad_lon:nlon, :) - values(nlon + 1:nlon + max_rad_lon, :) = values(1:max_rad_lon, :) - end if - - end subroutine get_var - -end module get_var_m diff --git a/Inst_eddies/input_ssh.f90 b/Inst_eddies/input_ssh.f90 index 674de64d0af4688282f551d195ca2be8241b7318..e1c04196bc188ef7dcc61f820ac124c9443d2eeb 100644 --- a/Inst_eddies/input_ssh.f90 +++ b/Inst_eddies/input_ssh.f90 @@ -21,7 +21,6 @@ contains nf95_get_var, nf95_close, nf95_nowrite use config_m, only: max_radius_deg - use get_var_m, only: get_var real, intent(out):: step(:) ! (2) longitude and latitude steps, in rad @@ -156,4 +155,52 @@ contains end subroutine input_ssh + !********************************************************************* + + subroutine get_var(periodic, max_rad_lon, values, ncid, nlon, name, & + new_fill_value) + + ! Read a NetCDF variable, change the missing value and extend it + ! in longitude if periodic. + + ! Libraries: + use netcdf95, only: nf95_inq_varid, nf95_get_var, nf95_get_missing + + logical, intent(in):: periodic ! grid is periodic in longitude + + integer, intent(in):: max_rad_lon ! maximum radius of an eddy in + ! longitude, in number of grid points, used only if periodic + + real, intent(out):: values(1 - merge(max_rad_lon, 0, periodic):, :) + ! (1 - merge(max_rad_lon, 0, periodic):nlon + merge(max_rad_lon, + ! 0, periodic), nlat) ssh, u or v. We cannot place this argument + ! first because the declaration references max_rad_lon and + ! periodic. + + integer, intent(in):: ncid, nlon + character(len = *), intent(in):: name ! of NetCDF variable + real, intent(in):: new_fill_value + + ! Local: + integer varid + real Fill_Value + + !------------------------------------------------------------------------- + + call nf95_inq_varid(ncid, name, varid) + call nf95_get_var(ncid, varid, values(1:nlon, :)) + call nf95_get_missing(ncid, varid, Fill_Value) + + ! Change the missing value: + where (values(1:nlon, :) == Fill_Value) values(1:nlon, :) = new_fill_value + + if (periodic) then + ! Extend in longitude: + values(1 - max_rad_lon:0, :) & + = values(nlon + 1 - max_rad_lon:nlon, :) + values(nlon + 1:nlon + max_rad_lon, :) = values(1:max_rad_lon, :) + end if + + end subroutine get_var + end module input_ssh_m