--- trunk/libf/dyn3d/start_init_phys_m.f90 2011/07/19 12:54:20 48 +++ trunk/libf/dyn3d/start_init_phys_m.f90 2011/08/24 11:43:14 49 @@ -9,30 +9,24 @@ SUBROUTINE start_init_phys(tsol_2d, qsol_2d) - USE flincom, only: flininfo, flinopen_nozoom, flinclo - use conf_dat2d_m, only: conf_dat2d - use inter_barxy_m, only: inter_barxy - use gr_int_dyn_m, only: gr_int_dyn use comgeom, only: rlonu, rlatv + use conf_dat2d_m, only: conf_dat2d use dimens_m, only: iim, jjm - use nr_util, only: assert + use gr_int_dyn_m, only: gr_int_dyn + use inter_barxy_m, only: inter_barxy + use jumble, only: find_longitude, find_latitude use netcdf, only: nf90_nowrite - use netcdf95, only: nf95_open, nf95_close, nf95_get_var, nf95_inq_varid + use netcdf95, only: nf95_open, nf95_close, nf95_get_var, nf95_inq_varid, & + nf95_gw_var + use nr_util, only: assert, pi REAL, intent(out):: tsol_2d(:, :), qsol_2d(:, :) ! (iim + 1, jjm + 1) ! Variables local to the procedure: - INTEGER fid_phys, iml_phys, jml_phys, ncid, varid - REAL, ALLOCATABLE, DIMENSION(:, :):: lon_phys, lat_phys - REAL date, dt - REAL, ALLOCATABLE:: levphys_ini(:) - - INTEGER itau(1) - INTEGER llm_tmp, ttm_tmp - + INTEGER iml_phys, jml_phys, ncid, varid REAL, ALLOCATABLE:: lon_rad(:), lat_rad(:) - REAL, ALLOCATABLE:: lon_ini(:), lat_ini(:) + REAL, pointer:: lon_ini(:), lat_ini(:) ! longitude and latitude in rad REAL, ALLOCATABLE:: var_ana(:, :) real tmp_var(iim, jjm + 1) @@ -45,41 +39,23 @@ call assert((/size(tsol_2d, 2), size(qsol_2d, 2)/) == jjm + 1, & "start_init_phys 2") - CALL flininfo('ECPHY.nc', iml_phys, jml_phys, llm_tmp, ttm_tmp, fid_phys) - - ALLOCATE(lat_phys(iml_phys, jml_phys)) - ALLOCATE(lon_phys(iml_phys, jml_phys)) - ALLOCATE(levphys_ini(llm_tmp)) - - CALL flinopen_nozoom(iml_phys, jml_phys, llm_tmp, lon_phys, lat_phys, & - levphys_ini, ttm_tmp, itau, date, dt, fid_phys) - CALL flinclo(fid_phys) + call nf95_open('ECPHY.nc', nf90_nowrite, ncid) - DEALLOCATE(levphys_ini) + call find_longitude(ncid, varid=varid) + call nf95_gw_var(ncid, varid, lon_ini) + lon_ini = lon_ini * pi / 180. ! convert to rad + iml_phys = size(lon_ini) + + call find_latitude(ncid, varid=varid) + call nf95_gw_var(ncid, varid, lat_ini) + lat_ini = lat_ini * pi / 180. ! convert to rad + jml_phys = size(lat_ini) ! Allocate the space we will need to get the data out of this file ALLOCATE(var_ana(iml_phys, jml_phys)) - ! In case we have a file which is in degrees we do the transformation ALLOCATE(lon_rad(iml_phys)) - ALLOCATE(lon_ini(iml_phys)) - - IF ( MAXVAL(lon_phys) > 2.0 * ASIN(1.0) ) THEN - lon_ini = lon_phys(:, 1) * 2.0 * ASIN(1.0) / 180.0 - ELSE - lon_ini = lon_phys(:, 1) - ENDIF - ALLOCATE(lat_rad(jml_phys)) - ALLOCATE(lat_ini(jml_phys)) - - IF ( MAXVAL(lat_phys) > 2.0 * ASIN(1.0) ) THEN - lat_ini = lat_phys(1, :) * 2.0 * ASIN(1.0) / 180.0 - ELSE - lat_ini = lat_phys(1, :) - ENDIF - - call nf95_open('ECPHY.nc', nf90_nowrite, ncid) ! We get the two standard variables ! 'ST': surface temperature @@ -99,6 +75,7 @@ qsol_2d = gr_int_dyn(tmp_var) call nf95_close(ncid) + deallocate(lon_ini, lat_ini) ! pointers END SUBROUTINE start_init_phys