Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sfc_climo_gen - use scale parameter to read scaled datasets #958

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions driver_scripts/driver_grid.orion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#SBATCH --open-mode=truncate
#SBATCH -o log.fv3_grid_driver
#SBATCH -e log.fv3_grid_driver
#SBATCH --nodes=2 --ntasks-per-node=15
#SBATCH -q debug
#SBATCH -t 00:30:00
#SBATCH --nodes=6 --ntasks-per-node=12
#SBATCH --partition=bigmem
#SBATCH -q batch
#SBATCH -t 04:30:00

#-----------------------------------------------------------------------
# Driver script to create a cubic-sphere based model grid on Orion.
Expand Down
46 changes: 45 additions & 1 deletion sorc/sfc_climo_gen.fd/interp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ subroutine interp(localpet, method, input_file)
integer :: varid, record
integer :: tile_num, pt_loc_this_tile
integer :: isrctermprocessing

double precision :: scale
integer(esmf_kind_i4), allocatable :: mask_mdl_one_tile(:,:)
integer(esmf_kind_i4), pointer :: unmapped_ptr(:)

Expand Down Expand Up @@ -110,7 +110,13 @@ subroutine interp(localpet, method, input_file)
status = nf90_inq_varid(ncid, field_names(n), varid)
call netcdf_err(status, "IN ROUTINE INTERP READING FIELD ID")
status = nf90_get_var(ncid, varid, data_src_global, start=(/1,1,t/), count=(/i_src,j_src,1/))

call netcdf_err(status, "IN ROUTINE INTERP READING FIELD")
status=nf90_get_att(ncid, varid, 'scale_factor', scale)
if (status == 0) then
call scale_data(data_src_global,i_src,j_src,scale)
endif

endif

print*,"- CALL FieldScatter FOR SOURCE GRID DATA."
Expand Down Expand Up @@ -257,6 +263,7 @@ subroutine interp(localpet, method, input_file)
endif
endif


enddo OUTPUT_LOOP

if (allocated(vegt_mdl_one_tile)) deallocate(vegt_mdl_one_tile)
Expand Down Expand Up @@ -306,6 +313,7 @@ subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch)
integer :: i, j, ierr

real :: landice_value


select case (field_ch)
case ('substrate_temperature') ! soil substrate temp
Expand Down Expand Up @@ -372,3 +380,39 @@ subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch)
end select

end subroutine adjust_for_landice




!> use Scale to fix the data to the correct value
!!
!! @param[inout] field to scale.
!! @param[in] idim i dimension of model tile.
!! @param[in] jdim j dimension of model tile.
!! @param[in] scale factor to scale the field.
!! @author George Gayno NCEP/EMC
!! @author Sanath Kumar NCEP/EMC
!!
subroutine scale_data(field,idim,jdim,scale)

use esmf
use mpi

implicit none
integer, intent(in) :: idim, jdim
integer :: i, j
real(esmf_kind_r4), intent(inout) :: field(idim,jdim)
double precision :: scale

do j = 1, jdim
do i = 1, idim
field(i,j) = field(i,j)*scale

enddo
enddo
end subroutine scale_data





4 changes: 3 additions & 1 deletion sorc/sfc_climo_gen.fd/source_grid.F90
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,11 @@ subroutine define_source_grid(localpet, npets, input_file)
call netcdf_err(status, "READING FIELD 1 ID")
status=nf90_get_att(ncid, varid, 'missing_value', missing)
call netcdf_err(status, "READING MISSING VALUE")

status = nf90_close(ncid)




!--------------------------------------------------------------------------
! Create ESMF grid object for the source data grid. Check if
! data is periodic in the east/west direction.
Expand Down
2 changes: 2 additions & 0 deletions ush/sfc_climo_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@ input_soil_color_file="${input_sfc_climo_dir}/soil_color.clm.0.05.nc"
input_vegetation_type_file="${VEG_TYPE_FILE}"
input_vegetation_greenness_file="${input_sfc_climo_dir}/vegetation_greenness.0.144.nc"
mosaic_file_mdl="$mosaic_file"
input_leaf_area_index_file="${input_sfc_climo_dir}/LAI_climo_pnnl.nc"
orog_dir_mdl="$FIX_FV3"
orog_files_mdl=$the_orog_files
halo=$HALO
maximum_snow_albedo_method="bilinear"
snowfree_albedo_method="bilinear"
vegetation_greenness_method="bilinear"
leaf_area_index_method="conserve"
fract_vegsoil_type=${vegsoilt_frac}
/
EOF
Expand Down
Loading