From 510d0a8f7275d04285773f3e0865c78816f540dd Mon Sep 17 00:00:00 2001 From: eric james Date: Wed, 9 Oct 2024 16:51:50 +0000 Subject: [PATCH 01/12] Changing PREC_ACC_DT to be real instead of integer (so it can be read by UPP) --- model_grid.F90 | 2 +- write_data.F90 | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/model_grid.F90 b/model_grid.F90 index eb5ae5b..0bfcc90 100644 --- a/model_grid.F90 +++ b/model_grid.F90 @@ -179,7 +179,7 @@ module model_grid !< with vertical dimension nVertLevelsp1 integer, public :: n_hist_fields_soil !< number of soil fields read from the hist file - integer, public :: diag_out_interval + real, public :: diag_out_interval !< output_interval from diag file integer, public :: do_u_interp !< whether 3d u is requested for interpolation diff --git a/write_data.F90 b/write_data.F90 index 224184f..988eb45 100644 --- a/write_data.F90 +++ b/write_data.F90 @@ -26,7 +26,7 @@ subroutine write_to_file(localpet) use program_setup, only: interp_diag, interp_hist, & wrf_mod_vars, truelat1, truelat2, & stand_lon, proj_code, map_proj_char, & - i_target, j_target, dx, & + i_target, j_target, dxkm, & ref_lat, ref_lon, pole_lat, & pole_lon, missing_value @@ -183,10 +183,10 @@ subroutine write_to_file(localpet) error = nf90_put_att(ncid, NF90_GLOBAL, 'START_DATE', start_time) call netcdf_err(error, 'DEFINING START DATE GLOBAL ATTRIBUTE') - error = nf90_put_att(ncid, NF90_GLOBAL, 'DX', dx) + error = nf90_put_att(ncid, NF90_GLOBAL, 'DX', dxkm) call netcdf_err(error, 'DEFINING DX GLOBAL ATTRIBUTE') - error = nf90_put_att(ncid, NF90_GLOBAL, 'DY', dx) + error = nf90_put_att(ncid, NF90_GLOBAL, 'DY', dxkm) call netcdf_err(error, 'DEFINING DY GLOBAL ATTRIBUTE') error = nf90_put_att(ncid, NF90_GLOBAL, 'DT', config_dt) From c284af4d14ca83c25bbc03992cd9af7838f77cfe Mon Sep 17 00:00:00 2001 From: eric james Date: Thu, 10 Oct 2024 21:16:43 +0000 Subject: [PATCH 02/12] Commenting out problematic line of code. --- interp.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interp.F90 b/interp.F90 index 7fcef59..d8c64cb 100644 --- a/interp.F90 +++ b/interp.F90 @@ -275,8 +275,8 @@ subroutine interp_diag_data(localpet) call rotate_winds_cgrid(localpet,2) endif - call fill_missing_bundle(localpet,input_diag_bundle,target_diag_bundle,2,i_target,j_target, & - method,bilinear_regrid,unmapped_ptr_bi) + !call fill_missing_bundle(localpet,input_diag_bundle,target_diag_bundle,2,i_target,j_target, & + ! method,bilinear_regrid,unmapped_ptr_bi) end subroutine interp_diag_data From 179a229ea36f7751ca1d9649af20921dae994fd6 Mon Sep 17 00:00:00 2001 From: eric james Date: Thu, 10 Oct 2024 22:07:30 +0000 Subject: [PATCH 03/12] Attempting to correctly set up 3D missing values for REFL_10CM --- interp.F90 | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/interp.F90 b/interp.F90 index d8c64cb..ff0db88 100644 --- a/interp.F90 +++ b/interp.F90 @@ -127,7 +127,7 @@ subroutine fill_missing_bundle(localpet,in_bundle,out_bundle,nd,nx,ny, & type(realptr_2d),allocatable :: fptr2(:) type(realptr_3d),allocatable :: fptr3(:) character(len=50) :: fname - integer :: num_fields, i, j, k, ij, l(1), u(1), rc + integer :: num_fields, i, j, k, ij, l(1), u(1), rc, ndims integer :: isrctermprocessing isrctermprocessing = 1 @@ -156,11 +156,8 @@ subroutine fill_missing_bundle(localpet,in_bundle,out_bundle,nd,nx,ny, & if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldBundleGet", rc) - if (nd==2) then - allocate(fptr2(num_fields)) - elseif (nd==3) then - allocate(fptr3(num_fields)) - endif + allocate(fptr2(num_fields)) + allocate(fptr3(num_fields)) do i=1, num_fields call ESMF_FieldBundleGet(out_bundle,i,field,rc=rc) @@ -169,12 +166,17 @@ subroutine fill_missing_bundle(localpet,in_bundle,out_bundle,nd,nx,ny, & call ESMF_FieldGet(field,name=fname,rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldGet", rc) - if (nd==2) then + if (fname=="REFL_10CM") then + ndims = 3 + else + ndims = nd + endif + if (ndims==2) then if(localpet==0) print*, '- FIELDGET 2D', fname call ESMF_FieldGet(field,farrayPtr=fptr2(i)%p,rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldGet", rc) - elseif (nd==3) then + elseif (ndims==3) then if(localpet==0) print*, '- FIELDGET 3D', fname call ESMF_FieldGet(field,farrayPtr=fptr3(i)%p,rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& @@ -186,8 +188,8 @@ subroutine fill_missing_bundle(localpet,in_bundle,out_bundle,nd,nx,ny, & do ij = l(1), u(1) call ij_to_i_j(unmapped_ptr(ij), nx, ny, i, j) do k = 1, num_fields - if (nd==2) fptr2(k)%p(i,j) = missing_value - if (nd==3) fptr3(k)%p(i,j,:) = missing_value + if (ndims==2) fptr2(k)%p(i,j) = missing_value + if (ndims==3) fptr3(k)%p(i,j,:) = missing_value enddo enddo if (allocated(fptr2)) deallocate(fptr2) From dff7aebd70acc00dfe446394aed7b541d8f5c6d3 Mon Sep 17 00:00:00 2001 From: eric james Date: Thu, 10 Oct 2024 22:11:13 +0000 Subject: [PATCH 04/12] Uncommenting fill_missing_bundle call. --- interp.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interp.F90 b/interp.F90 index ff0db88..43c3a60 100644 --- a/interp.F90 +++ b/interp.F90 @@ -277,8 +277,8 @@ subroutine interp_diag_data(localpet) call rotate_winds_cgrid(localpet,2) endif - !call fill_missing_bundle(localpet,input_diag_bundle,target_diag_bundle,2,i_target,j_target, & - ! method,bilinear_regrid,unmapped_ptr_bi) + call fill_missing_bundle(localpet,input_diag_bundle,target_diag_bundle,2,i_target,j_target, & + method,bilinear_regrid,unmapped_ptr_bi) end subroutine interp_diag_data From 1d2092725cd6f6fff553c685f302ce1eb82144b5 Mon Sep 17 00:00:00 2001 From: eric james Date: Wed, 16 Oct 2024 16:44:01 +0000 Subject: [PATCH 05/12] Not sure where I left this... --- write_data.F90 | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/write_data.F90 b/write_data.F90 index 988eb45..e3dfd4a 100644 --- a/write_data.F90 +++ b/write_data.F90 @@ -140,6 +140,8 @@ subroutine write_to_file(localpet) allocate (dum3d(i_target, j_target, nz_input)) allocate (dum1d(1)) + if (localpet == 0) print *, "ITARGET,JTARGET,NZINPUT",i_target,j_target,nz_input + !--- open the file error = nf90_create_par(output_file, NF90_NETCDF4, & MPI_COMM_WORLD, & @@ -1304,6 +1306,7 @@ subroutine write_to_file(localpet) call error_handler("IN FieldGet", error) if (localpet == 0) print *, "- WRITE TO FILE ", trim(varname) + if (localpet == 0) print *,clb(1),cub(1),clb(2),cub(2) dum2d(:, :) = dum2dptr(clb(1):cub(1),clb(2):cub(2)) error = nf90_put_var(ncid, id_vars2(i), dum2d, start = (/clb(1),clb(2),1/), & count=(/count1, count2, 1/)) @@ -1314,6 +1317,8 @@ subroutine write_to_file(localpet) ! 3d fields from diaglist +! if (allocated(dum3d)) deallocate(dum3d) +! allocate(dum3d(clb(1):cub(1),clb(2):cub(2),nz_input)) if (n3d > 0) then print *, "Loop writing over ", n3d, "3-d nz vars" do i = 1, n3d @@ -1323,10 +1328,17 @@ subroutine write_to_file(localpet) call ESMF_FieldGet(field_extra3(i), farrayPtr = dum3dptr, rc=error) if (ESMF_logFoundError(rcToCheck=error, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) & call error_handler("IN FieldGet", error) - + !if (localpet == 0) print *,clb(1),cub(1),clb(2),cub(2) + if (localpet == 0) print *,shape(dum3d) + if (localpet == 0) print *,shape(dum3dptr) + if (localpet == 0) print *,clb(1) + if (localpet == 0) print *,cub(1) + if (localpet == 0) print *,clb(2) + if (localpet == 0) print *,cub(2) dum3d(:,:,:) = dum3dptr(clb(1):cub(1),clb(2):cub(2),:) + !dum3d(:,:,:) = dum3dptr(1:1799,clb(2):cub(2),:) if (localpet == 0) print *, trim(varname), minval(dum3d), maxval(dum3d) - error = nf90_put_var(ncid, id_vars3_nz(i), dum3d, start = (/clb(1),clb(2),1,1/), & + error = nf90_put_var(ncid, id_vars3_nz(i), dum3d, start = (/1,1,1,1/), & count=(/count1,count2, nz_input, 1/)) call netcdf_err(error, 'WRITING RECORD') end do @@ -1408,6 +1420,13 @@ subroutine write_to_file(localpet) end do end do else + !if (localpet == 0) print *,clb(1),cub(1),clb(2),cub(2) + if (localpet == 0) print *,shape(dum3d) + if (localpet == 0) print *,shape(dum3dptr) + if (localpet == 0) print *,clb(1) + if (localpet == 0) print *,cub(1) + if (localpet == 0) print *,clb(2) + if (localpet == 0) print *,cub(2) dum3d(:,:,:) = dum3dptr(clb(1):cub(1),clb(2):cub(2),:) end if if (localpet==0) print *, trim(varname), minval(dum3d), maxval(dum3d) From 594830552fa1418df2ad9e56c16b69c2377395cf Mon Sep 17 00:00:00 2001 From: eric james Date: Wed, 16 Oct 2024 18:43:53 +0000 Subject: [PATCH 06/12] Update write_data.F90 --- write_data.F90 | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/write_data.F90 b/write_data.F90 index e3dfd4a..8083e36 100644 --- a/write_data.F90 +++ b/write_data.F90 @@ -582,9 +582,11 @@ subroutine write_to_file(localpet) call error_handler("IN FieldBundleGet", error) do i = 1, n_diag_fields call ESMF_FieldGet(fields(i), name=varname, rc=error) + if (localpet == 0) print *, varname if (ESMF_logFoundError(rcToCheck=error, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) & call error_handler("IN FieldGet", error) call ESMF_FieldGet(fields(i), dimCount=ndims, rc=rc) + if (localpet == 0) print *, ndims if (ESMF_logFoundError(rcToCheck=error, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) & call error_handler("IN FieldGet", error) @@ -593,6 +595,13 @@ subroutine write_to_file(localpet) field_write_2d(k) = fields(i) if (localpet == 0) print *, "- DEFINE 2d diag ON FILE TARGET GRID ", varname error = nf90_def_var(ncid, varname, NF90_FLOAT, (/dim_lon, dim_lat, dim_time/), id_vars2(k)) + if (localpet == 0) print *, dim_lon + if (localpet == 0) print *, dim_lat + if (localpet == 0) print *, dim_time + if (localpet == 0) print *, id_vars2(k) + if (localpet == 0) print *, k + if (localpet == 0) print *, target_diag_units(i) + if (localpet == 0) print *, target_diag_longname(i) call netcdf_err(error, 'DEFINING VAR') error = nf90_put_att(ncid, id_vars2(k), "MemoryOrder", "XY ") call netcdf_err(error, 'DEFINING MEMORYORDER') @@ -615,6 +624,14 @@ subroutine write_to_file(localpet) field_extra3(m) = fields(i) if (localpet == 0) print *, "- DEFINE 3d diag ON FILE TARGET GRID ", varname error = nf90_def_var(ncid, varname, NF90_FLOAT, (/dim_lon, dim_lat, dim_z, dim_time/), id_vars3_nz(m)) + if (localpet == 0) print *, dim_lon + if (localpet == 0) print *, dim_lat + if (localpet == 0) print *, dim_z + if (localpet == 0) print *, dim_time + if (localpet == 0) print *, id_vars3_nz(m) + if (localpet == 0) print *, m + if (localpet == 0) print *, target_diag_units(i) + if (localpet == 0) print *, target_diag_longname(i) call netcdf_err(error, 'DEFINING VAR') error = nf90_put_att(ncid, id_vars3_nz(m), "MemoryOrder", "XYZ ") call netcdf_err(error, 'DEFINING MEMORYORDER') @@ -764,6 +781,14 @@ subroutine write_to_file(localpet) call error_handler("IN FieldGet", error) if (localpet == 0) print *, "- DEFINE ON FILE TARGET GRID ", varname error = nf90_def_var(ncid, varname, NF90_FLOAT, (/dim_lon, dim_lat, dim_soil, dim_time/), id_vars_soil(i)) + if (localpet == 0) print *, dim_lon + if (localpet == 0) print *, dim_lat + if (localpet == 0) print *, dim_soil + if (localpet == 0) print *, dim_time + if (localpet == 0) print *, id_vars_soil(i) + if (localpet == 0) print *, i + if (localpet == 0) print *, target_hist_units_soil(i) + if (localpet == 0) print *, target_hist_longname_soil(i) call netcdf_err(error, 'DEFINING VAR') error = nf90_put_att(ncid, id_vars_soil(i), "MemoryOrder", "XYZ ") call netcdf_err(error, 'DEFINING MEMORYORDER') @@ -799,6 +824,14 @@ subroutine write_to_file(localpet) call error_handler("IN FieldGet", error) if (localpet == 0) print *, "- DEFINE ON FILE TARGET GRID ", varname error = nf90_def_var(ncid, varname, NF90_FLOAT, (/dim_lon, dim_lat, dim_z, dim_time/), id_vars3_nz(i + n3d)) + if (localpet == 0) print *, dim_lon + if (localpet == 0) print *, dim_lat + if (localpet == 0) print *, dim_z + if (localpet == 0) print *, dim_time + if (localpet == 0) print *, id_vars3_nz(i+n3d) + if (localpet == 0) print *, i+n3d + if (localpet == 0) print *, target_hist_units_3d_nz(i) + if (localpet == 0) print *, target_hist_longname_3d_nz(i) call netcdf_err(error, 'DEFINING VAR') error = nf90_put_att(ncid, id_vars3_nz(i + n3d), "MemoryOrder", "XYZ ") call netcdf_err(error, 'DEFINING MEMORYORDER') @@ -1317,8 +1350,8 @@ subroutine write_to_file(localpet) ! 3d fields from diaglist -! if (allocated(dum3d)) deallocate(dum3d) -! allocate(dum3d(clb(1):cub(1),clb(2):cub(2),nz_input)) + if (allocated(dum3d)) deallocate(dum3d) + allocate(dum3d(clb(1):cub(1),clb(2):cub(2),nz_input)) if (n3d > 0) then print *, "Loop writing over ", n3d, "3-d nz vars" do i = 1, n3d @@ -1338,7 +1371,7 @@ subroutine write_to_file(localpet) dum3d(:,:,:) = dum3dptr(clb(1):cub(1),clb(2):cub(2),:) !dum3d(:,:,:) = dum3dptr(1:1799,clb(2):cub(2),:) if (localpet == 0) print *, trim(varname), minval(dum3d), maxval(dum3d) - error = nf90_put_var(ncid, id_vars3_nz(i), dum3d, start = (/1,1,1,1/), & + error = nf90_put_var(ncid, id_vars3_nz(i), dum3d, start = (/clb(1),clb(2),1,1/), & count=(/count1,count2, nz_input, 1/)) call netcdf_err(error, 'WRITING RECORD') end do From 76f21bfbfc7d16267b2911626d51823f76d7ce30 Mon Sep 17 00:00:00 2001 From: eric james Date: Wed, 16 Oct 2024 18:47:08 +0000 Subject: [PATCH 07/12] Getting rid of print statements. --- write_data.F90 | 51 -------------------------------------------------- 1 file changed, 51 deletions(-) diff --git a/write_data.F90 b/write_data.F90 index 8083e36..c163043 100644 --- a/write_data.F90 +++ b/write_data.F90 @@ -140,8 +140,6 @@ subroutine write_to_file(localpet) allocate (dum3d(i_target, j_target, nz_input)) allocate (dum1d(1)) - if (localpet == 0) print *, "ITARGET,JTARGET,NZINPUT",i_target,j_target,nz_input - !--- open the file error = nf90_create_par(output_file, NF90_NETCDF4, & MPI_COMM_WORLD, & @@ -582,11 +580,9 @@ subroutine write_to_file(localpet) call error_handler("IN FieldBundleGet", error) do i = 1, n_diag_fields call ESMF_FieldGet(fields(i), name=varname, rc=error) - if (localpet == 0) print *, varname if (ESMF_logFoundError(rcToCheck=error, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) & call error_handler("IN FieldGet", error) call ESMF_FieldGet(fields(i), dimCount=ndims, rc=rc) - if (localpet == 0) print *, ndims if (ESMF_logFoundError(rcToCheck=error, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) & call error_handler("IN FieldGet", error) @@ -595,13 +591,6 @@ subroutine write_to_file(localpet) field_write_2d(k) = fields(i) if (localpet == 0) print *, "- DEFINE 2d diag ON FILE TARGET GRID ", varname error = nf90_def_var(ncid, varname, NF90_FLOAT, (/dim_lon, dim_lat, dim_time/), id_vars2(k)) - if (localpet == 0) print *, dim_lon - if (localpet == 0) print *, dim_lat - if (localpet == 0) print *, dim_time - if (localpet == 0) print *, id_vars2(k) - if (localpet == 0) print *, k - if (localpet == 0) print *, target_diag_units(i) - if (localpet == 0) print *, target_diag_longname(i) call netcdf_err(error, 'DEFINING VAR') error = nf90_put_att(ncid, id_vars2(k), "MemoryOrder", "XY ") call netcdf_err(error, 'DEFINING MEMORYORDER') @@ -624,14 +613,6 @@ subroutine write_to_file(localpet) field_extra3(m) = fields(i) if (localpet == 0) print *, "- DEFINE 3d diag ON FILE TARGET GRID ", varname error = nf90_def_var(ncid, varname, NF90_FLOAT, (/dim_lon, dim_lat, dim_z, dim_time/), id_vars3_nz(m)) - if (localpet == 0) print *, dim_lon - if (localpet == 0) print *, dim_lat - if (localpet == 0) print *, dim_z - if (localpet == 0) print *, dim_time - if (localpet == 0) print *, id_vars3_nz(m) - if (localpet == 0) print *, m - if (localpet == 0) print *, target_diag_units(i) - if (localpet == 0) print *, target_diag_longname(i) call netcdf_err(error, 'DEFINING VAR') error = nf90_put_att(ncid, id_vars3_nz(m), "MemoryOrder", "XYZ ") call netcdf_err(error, 'DEFINING MEMORYORDER') @@ -781,14 +762,6 @@ subroutine write_to_file(localpet) call error_handler("IN FieldGet", error) if (localpet == 0) print *, "- DEFINE ON FILE TARGET GRID ", varname error = nf90_def_var(ncid, varname, NF90_FLOAT, (/dim_lon, dim_lat, dim_soil, dim_time/), id_vars_soil(i)) - if (localpet == 0) print *, dim_lon - if (localpet == 0) print *, dim_lat - if (localpet == 0) print *, dim_soil - if (localpet == 0) print *, dim_time - if (localpet == 0) print *, id_vars_soil(i) - if (localpet == 0) print *, i - if (localpet == 0) print *, target_hist_units_soil(i) - if (localpet == 0) print *, target_hist_longname_soil(i) call netcdf_err(error, 'DEFINING VAR') error = nf90_put_att(ncid, id_vars_soil(i), "MemoryOrder", "XYZ ") call netcdf_err(error, 'DEFINING MEMORYORDER') @@ -824,14 +797,6 @@ subroutine write_to_file(localpet) call error_handler("IN FieldGet", error) if (localpet == 0) print *, "- DEFINE ON FILE TARGET GRID ", varname error = nf90_def_var(ncid, varname, NF90_FLOAT, (/dim_lon, dim_lat, dim_z, dim_time/), id_vars3_nz(i + n3d)) - if (localpet == 0) print *, dim_lon - if (localpet == 0) print *, dim_lat - if (localpet == 0) print *, dim_z - if (localpet == 0) print *, dim_time - if (localpet == 0) print *, id_vars3_nz(i+n3d) - if (localpet == 0) print *, i+n3d - if (localpet == 0) print *, target_hist_units_3d_nz(i) - if (localpet == 0) print *, target_hist_longname_3d_nz(i) call netcdf_err(error, 'DEFINING VAR') error = nf90_put_att(ncid, id_vars3_nz(i + n3d), "MemoryOrder", "XYZ ") call netcdf_err(error, 'DEFINING MEMORYORDER') @@ -1339,7 +1304,6 @@ subroutine write_to_file(localpet) call error_handler("IN FieldGet", error) if (localpet == 0) print *, "- WRITE TO FILE ", trim(varname) - if (localpet == 0) print *,clb(1),cub(1),clb(2),cub(2) dum2d(:, :) = dum2dptr(clb(1):cub(1),clb(2):cub(2)) error = nf90_put_var(ncid, id_vars2(i), dum2d, start = (/clb(1),clb(2),1/), & count=(/count1, count2, 1/)) @@ -1361,15 +1325,7 @@ subroutine write_to_file(localpet) call ESMF_FieldGet(field_extra3(i), farrayPtr = dum3dptr, rc=error) if (ESMF_logFoundError(rcToCheck=error, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) & call error_handler("IN FieldGet", error) - !if (localpet == 0) print *,clb(1),cub(1),clb(2),cub(2) - if (localpet == 0) print *,shape(dum3d) - if (localpet == 0) print *,shape(dum3dptr) - if (localpet == 0) print *,clb(1) - if (localpet == 0) print *,cub(1) - if (localpet == 0) print *,clb(2) - if (localpet == 0) print *,cub(2) dum3d(:,:,:) = dum3dptr(clb(1):cub(1),clb(2):cub(2),:) - !dum3d(:,:,:) = dum3dptr(1:1799,clb(2):cub(2),:) if (localpet == 0) print *, trim(varname), minval(dum3d), maxval(dum3d) error = nf90_put_var(ncid, id_vars3_nz(i), dum3d, start = (/clb(1),clb(2),1,1/), & count=(/count1,count2, nz_input, 1/)) @@ -1453,13 +1409,6 @@ subroutine write_to_file(localpet) end do end do else - !if (localpet == 0) print *,clb(1),cub(1),clb(2),cub(2) - if (localpet == 0) print *,shape(dum3d) - if (localpet == 0) print *,shape(dum3dptr) - if (localpet == 0) print *,clb(1) - if (localpet == 0) print *,cub(1) - if (localpet == 0) print *,clb(2) - if (localpet == 0) print *,cub(2) dum3d(:,:,:) = dum3dptr(clb(1):cub(1),clb(2):cub(2),:) end if if (localpet==0) print *, trim(varname), minval(dum3d), maxval(dum3d) From 48791256ad8985e7e8cd6bf894d9cd761a923ca9 Mon Sep 17 00:00:00 2001 From: eric james Date: Wed, 16 Oct 2024 18:48:15 +0000 Subject: [PATCH 08/12] Cosmetic changes in write_data.F90 --- write_data.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/write_data.F90 b/write_data.F90 index c163043..962195e 100644 --- a/write_data.F90 +++ b/write_data.F90 @@ -1324,7 +1324,8 @@ subroutine write_to_file(localpet) call error_handler("IN FieldGet", error) call ESMF_FieldGet(field_extra3(i), farrayPtr = dum3dptr, rc=error) if (ESMF_logFoundError(rcToCheck=error, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) & - call error_handler("IN FieldGet", error) + call error_handler("IN FieldGet", error) + dum3d(:,:,:) = dum3dptr(clb(1):cub(1),clb(2):cub(2),:) if (localpet == 0) print *, trim(varname), minval(dum3d), maxval(dum3d) error = nf90_put_var(ncid, id_vars3_nz(i), dum3d, start = (/clb(1),clb(2),1,1/), & From c0af8d1e10476232543bd9af86ef45624e230b5c Mon Sep 17 00:00:00 2001 From: eric james Date: Wed, 16 Oct 2024 18:49:05 +0000 Subject: [PATCH 09/12] More small changes to write_data.F90 --- write_data.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/write_data.F90 b/write_data.F90 index 962195e..78e70e9 100644 --- a/write_data.F90 +++ b/write_data.F90 @@ -1324,8 +1324,8 @@ subroutine write_to_file(localpet) call error_handler("IN FieldGet", error) call ESMF_FieldGet(field_extra3(i), farrayPtr = dum3dptr, rc=error) if (ESMF_logFoundError(rcToCheck=error, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) & - call error_handler("IN FieldGet", error) - + call error_handler("IN FieldGet", error) + dum3d(:,:,:) = dum3dptr(clb(1):cub(1),clb(2):cub(2),:) if (localpet == 0) print *, trim(varname), minval(dum3d), maxval(dum3d) error = nf90_put_var(ncid, id_vars3_nz(i), dum3d, start = (/clb(1),clb(2),1,1/), & From c4065dea736671f232acd7f4e92d3cf800572bb5 Mon Sep 17 00:00:00 2001 From: eric james Date: Wed, 16 Oct 2024 18:49:51 +0000 Subject: [PATCH 10/12] More small changes to write_data.F90 --- write_data.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/write_data.F90 b/write_data.F90 index 78e70e9..7021717 100644 --- a/write_data.F90 +++ b/write_data.F90 @@ -1324,7 +1324,7 @@ subroutine write_to_file(localpet) call error_handler("IN FieldGet", error) call ESMF_FieldGet(field_extra3(i), farrayPtr = dum3dptr, rc=error) if (ESMF_logFoundError(rcToCheck=error, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) & - call error_handler("IN FieldGet", error) + call error_handler("IN FieldGet", error) dum3d(:,:,:) = dum3dptr(clb(1):cub(1),clb(2):cub(2),:) if (localpet == 0) print *, trim(varname), minval(dum3d), maxval(dum3d) From a50b73583bbc38b23e68e1a933bb64cb48ac4fba Mon Sep 17 00:00:00 2001 From: eric james Date: Wed, 16 Oct 2024 18:50:19 +0000 Subject: [PATCH 11/12] Last change to write_data.F90 --- write_data.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/write_data.F90 b/write_data.F90 index 7021717..28789c9 100644 --- a/write_data.F90 +++ b/write_data.F90 @@ -1324,7 +1324,7 @@ subroutine write_to_file(localpet) call error_handler("IN FieldGet", error) call ESMF_FieldGet(field_extra3(i), farrayPtr = dum3dptr, rc=error) if (ESMF_logFoundError(rcToCheck=error, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) & - call error_handler("IN FieldGet", error) + call error_handler("IN FieldGet", error) dum3d(:,:,:) = dum3dptr(clb(1):cub(1),clb(2):cub(2),:) if (localpet == 0) print *, trim(varname), minval(dum3d), maxval(dum3d) From b0c7fba3cb7d00fc2be05b9272b1519ad8d2b93a Mon Sep 17 00:00:00 2001 From: Eric James Date: Wed, 16 Oct 2024 22:14:11 +0000 Subject: [PATCH 12/12] Update to handle missing values for REFL_10CM --- interp.F90 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/interp.F90 b/interp.F90 index 43c3a60..42bf5cd 100644 --- a/interp.F90 +++ b/interp.F90 @@ -188,6 +188,18 @@ subroutine fill_missing_bundle(localpet,in_bundle,out_bundle,nd,nx,ny, & do ij = l(1), u(1) call ij_to_i_j(unmapped_ptr(ij), nx, ny, i, j) do k = 1, num_fields + call ESMF_FieldBundleGet(out_bundle,k,field,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldBundleGet", rc) + call ESMF_FieldGet(field,name=fname,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldGet", rc) + if (fname=="REFL_10CM") then + ndims = 3 + else + ndims = nd + endif + if(localpet==0) print*, k, ndims if (ndims==2) fptr2(k)%p(i,j) = missing_value if (ndims==3) fptr3(k)%p(i,j,:) = missing_value enddo