diff --git a/WPS/geogrid/src/output_module.F b/WPS/geogrid/src/output_module.F index 56038974..5be42f63 100644 --- a/WPS/geogrid/src/output_module.F +++ b/WPS/geogrid/src/output_module.F @@ -444,7 +444,7 @@ subroutine init_output_fields(nest_num, grid_type, & character (len=128) :: fieldname character (len=128) :: memorder, units, description character (len=128), dimension(3) :: dimnames - integer :: sr_x, sr_y + integer :: sr_x, sr_y, istatus ! ! First find out how many fields there are @@ -467,7 +467,7 @@ subroutine init_output_fields(nest_num, grid_type, & #endif #ifdef _GEOGRID - if (grid_type == 'C') NUM_AUTOMATIC_FIELDS = 22 + if (grid_type == 'C') NUM_AUTOMATIC_FIELDS = 24 if (grid_type == 'E') NUM_AUTOMATIC_FIELDS = 7 NUM_FIELDS = nfields+NUM_AUTOMATIC_FIELDS @@ -569,7 +569,15 @@ subroutine init_output_fields(nest_num, grid_type, & fields(22)%fieldname = 'LANDMASK' fields(22)%units = 'none' fields(22)%descr = 'Landmask : 1=land, 0=water' - + + fields(23)%fieldname = 'FXLONG' + fields(23)%units = 'degrees longitude' + fields(23)%descr = 'Longitude on refined grid' + + fields(24)%fieldname = 'FXLAT' + fields(24)%units = 'degrees latitude' + fields(24)%descr = 'Latitude on refined grid' + else if (grid_type == 'E') then fields(1)%fieldname = 'XLAT_M' fields(1)%units = 'degrees latitude' @@ -761,7 +769,29 @@ subroutine init_output_fields(nest_num, grid_type, & fields(17)%dimnames(1) = 'west_east_stag' fields(17)%stagger = 'U' fields(17)%istagger = U - + + ! + ! Perform adjustments for subgrid lat/lon fields + ! + do i=23,24 + + call get_subgrid_dim_default(nest_num,fields(i)%dimnames, & + fields(i)%sr_x,fields(i)%sr_y,istatus) + fields(i)%dom_end(1)=(fields(i)%dom_end(1)-fields(i)%dom_start(1)+2) & + * fields(i)%sr_x + fields(i)%dom_end(2)=(fields(i)%dom_end(2)-fields(i)%dom_start(2)+2) & + * fields(i)%sr_y + fields(i)%mem_end(1)=(fields(i)%mem_end(1)-fields(i)%mem_start(1)+2) & + * fields(i)%sr_x + fields(i)%mem_end(2)=(fields(i)%mem_end(2)-fields(i)%mem_start(2)+2) & + * fields(i)%sr_y + fields(i)%patch_end(1)=(fields(i)%patch_end(1)-fields(i)%patch_start(1)+2) & + * fields(i)%sr_x + fields(i)%patch_end(2)=(fields(i)%patch_end(2)-fields(i)%patch_start(2)+2) & + * fields(i)%sr_y + + enddo + else if (grid_type == 'E') then ! Lat V fields(3)%stagger = 'V' @@ -868,7 +898,7 @@ subroutine init_output_fields(nest_num, grid_type, & thalo_width = 0 #endif - if (sr_x > 1) then + if (sr_x > 1 .and. sr_y > 1) then fields(nfields)%mem_start(1) = (fields(nfields)%mem_start(1) + lhalo_width - 1)*sr_x + 1 - lhalo_width fields(nfields)%patch_start(1) = (fields(nfields)%patch_start(1) - 1)*sr_x + 1 fields(nfields)%dom_start(1) = (fields(nfields)%dom_start(1) - 1)*sr_x + 1 @@ -876,9 +906,7 @@ subroutine init_output_fields(nest_num, grid_type, & fields(nfields)%mem_end(1) = (fields(nfields)%mem_end(1) - rhalo_width)*sr_x + rhalo_width fields(nfields)%patch_end(1) = (fields(nfields)%patch_end(1) )*sr_x fields(nfields)%dom_end(1) = (fields(nfields)%dom_end(1) )*sr_x - endif - - if (sr_y > 1) then + fields(nfields)%mem_start(2) = (fields(nfields)%mem_start(2) + bhalo_width - 1)*sr_y + 1 - bhalo_width fields(nfields)%patch_start(2) = (fields(nfields)%patch_start(2) - 1)*sr_y + 1 fields(nfields)%dom_start(2) = (fields(nfields)%dom_start(2) - 1)*sr_y + 1 @@ -886,8 +914,10 @@ subroutine init_output_fields(nest_num, grid_type, & fields(nfields)%mem_end(2) = (fields(nfields)%mem_end(2) - thalo_width)*sr_y + thalo_width fields(nfields)%patch_end(2) = (fields(nfields)%patch_end(2) )*sr_y fields(nfields)%dom_end(2) = (fields(nfields)%dom_end(2) )*sr_y - endif + call get_subgrid_dim_default(nest_num,fields(nfields)%dimnames, & + sr_x,sr_y,istatus) + endif nfields = nfields + 1 diff --git a/WPS/geogrid/src/source_data_module.F b/WPS/geogrid/src/source_data_module.F index 71c13484..c507afb1 100644 --- a/WPS/geogrid/src/source_data_module.F +++ b/WPS/geogrid/src/source_data_module.F @@ -2335,6 +2335,13 @@ subroutine get_subgrid_dim_name(nest_num, field_name, dimnames, & sub_y = 1 istatus = 0 + if (((index(trim(field_name),'FXLAT') /= 0) .and. & + (len_trim(field_name) == len_trim('FXLAT'))) .or. & + ((index(trim(field_name),'FXLONG') /=0) .and. & + (len_trim(field_name) == len_trim('FXLONG'))))then + call get_subgrid_dim_default(nest_num,dimnames,sub_x,sub_y,istatus) + endif + do idx=1,num_entries if ((index(source_fieldname(idx),trim(field_name)) /= 0) .and. & (len_trim(source_fieldname(idx)) == len_trim(field_name))) then @@ -2343,10 +2350,7 @@ subroutine get_subgrid_dim_name(nest_num, field_name, dimnames, & if (is_output_stagger(idx)) then call mprintf(.true.,ERROR,'Cannot use subgrids on variables with staggered grids') end if - dimnames(1) = trim(dimnames(1))//"_subgrid" - dimnames(2) = trim(dimnames(2))//"_subgrid" - sub_x = subgrid_ratio_x(nest_num) - sub_y = subgrid_ratio_y(nest_num) + call get_subgrid_dim_default(nest_num,dimnames,sub_x,sub_y,istatus) end if end if end do @@ -2354,6 +2358,24 @@ subroutine get_subgrid_dim_name(nest_num, field_name, dimnames, & end subroutine get_subgrid_dim_name + subroutine get_subgrid_dim_default(nest_num,dimnames,sub_x,sub_y,istatus) + use gridinfo_module + + implicit none + + integer,intent(in)::nest_num + integer,intent(out)::sub_x,sub_y,istatus + character(len=128),dimension(2),intent(out)::dimnames + + dimnames(1)='west_east_subgrid' + dimnames(2)='south_north_subgrid' + sub_x=subgrid_ratio_x(nest_num) + sub_y=subgrid_ratio_y(nest_num) + istatus=0 + + end subroutine get_subgrid_dim_default + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Name: get_interp_option !