diff --git a/Project.toml b/Project.toml index 68ee3c33ac..fafc4e1d87 100644 --- a/Project.toml +++ b/Project.toml @@ -35,7 +35,7 @@ DocStringExtensions = "0.8, 0.9" Insolation = "0.8" JLD2 = "0.4" NCDatasets = "0.11, 0.12, 0.13" -Plots = "=1.39.0" +Plots = "1.39.0" SciMLBase = "1, 2" StaticArrays = "1" Statistics = "1" diff --git a/src/BCReader.jl b/src/BCReader.jl index 62b8eac8d8..fd27f7268b 100644 --- a/src/BCReader.jl +++ b/src/BCReader.jl @@ -185,11 +185,11 @@ function update_midmonth_data!(date, bcf_info::BCFileInfo{FT}) where {FT} segment_idx = bcf_info.segment_idx[1] # index of the current date in the file. [segment_idx, segment_idx+1] indexes the current segment between which we interpolate segment_idx0 = bcf_info.segment_idx0[1] # reference index (first segment_idx - 1) - # upon initialization (segment_idx == segment_idx0) and not initialized after final file date + # upon initialization (segment_idx == segment_idx0) and initialized before the final file date if (segment_idx == segment_idx0) && !((date - all_dates[end]).value >= 0) # case 1: model date is before the first segment read from file - if (date - all_dates[segment_idx]).value < 0 - @warn "this time period is before BC data - using file from $(all_dates[segment_idx0])" + if (date - all_dates[segment_idx0]).value < 0 + @warn "This time period is before BC data - using file from $(all_dates[segment_idx0])" bcf_info.monthly_fields[1] .= scaling_function( Regridder.read_from_hdf5(bcfile_dir, hd_outfile_root, all_dates[Int(segment_idx0)], varname, comms_ctx), bcf_info, @@ -213,7 +213,7 @@ function update_midmonth_data!(date, bcf_info::BCFileInfo{FT}) where {FT} update_midmonth_data!(date, bcf_info) # case 3: model date is within the first segment read from file - elseif (date - all_dates[segment_idx]).value >= 0 + elseif (date - all_dates[segment_idx0]).value >= 0 @warn "On $date updating file data reads: file dates = [ $(all_dates[segment_idx]) , $(all_dates[segment_idx+1]) ]" bcf_info.segment_length .= (all_dates[segment_idx + 1] - all_dates[segment_idx]).value bcf_info.monthly_fields[1] .= scaling_function( @@ -229,7 +229,7 @@ function update_midmonth_data!(date, bcf_info::BCFileInfo{FT}) where {FT} # case 4: date is at or after the last date in file elseif (date - all_dates[end]).value >= 0 - @warn "this time period is after BC data - using file from $(all_dates[end])" + @warn "This time period is after BC data - using file from $(all_dates[end])" bcf_info.monthly_fields[1] .= scaling_function( Regridder.read_from_hdf5( bcfile_dir, @@ -247,7 +247,6 @@ function update_midmonth_data!(date, bcf_info::BCFileInfo{FT}) where {FT} elseif (date - all_dates[Int(segment_idx) + 1]).value >= 0 segment_idx = bcf_info.segment_idx[1] += Int(1) - @warn "On $date updating file data reads: file dates = [ $(all_dates[Int(segment_idx)]) , $(all_dates[Int(segment_idx+1)]) ]" bcf_info.segment_length .= (all_dates[Int(segment_idx + 1)] - all_dates[Int(segment_idx)]).value bcf_info.monthly_fields[1] .= scaling_function(