diff --git a/Tools/links.py b/Tools/links.py new file mode 100755 index 00000000..cdd401b8 --- /dev/null +++ b/Tools/links.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python + +import os + +for year in ['0001','0002','0003','0004','0005','0006','0007','0008','0009','0010','0011','0012','0013','0014','0015']: + for month in ['01','02','03','04','05','06','07','08','09','10','11','12']: + + srcdir = '/glade/p/cesm0005/archive/b.e20.B1850.f09_g17.pi_control.all.250/ocn/hist' + linkdir = '/glade/scratch/aliceb/b.e20.B1850.f09_g17.pi_control.all.250/ocn/hist' + + if not os.path.exists(linkdir): + os.makedirs(linkdir) + + casename = 'b.e20.B1850.f09_g17.pi_control.all.250.pop.h' + filename = '{0}.{1}-{2}.nc'.format(casename,year,month) + os.symlink(os.path.join(srcdir, filename), os.path.join(linkdir, filename)) + + +for year in ['0001','0002','0003','0004','0005','0006','0007','0008','0009','0010','0011','0012','0013','0014','0015']: + for month in ['01','02','03','04','05','06','07','08','09','10','11','12']: + + srcdir = '/glade/p/cesm0005/archive/b.e20.B1850.f09_g17.pi_control.all.250/ice/hist' + linkdir = '/glade/scratch/aliceb/b.e20.B1850.f09_g17.pi_control.all.250/ice/hist' + + if not os.path.exists(linkdir): + os.makedirs(linkdir) + + casename = 'b.e20.B1850.f09_g17.pi_control.all.250.cice.h' + filename = '{0}.{1}-{2}.nc'.format(casename,year,month) + os.symlink(os.path.join(srcdir, filename), os.path.join(linkdir, filename)) + + +for year in ['0001','0002','0003','0004','0005','0006','0007','0008','0009','0010','0011','0012','0013','0014','0015']: + for month in ['01','02','03','04','05','06','07','08','09','10','11','12']: + + srcdir = '/glade/p/cesm0005/archive/b.e20.B1850.f09_g17.pi_control.all.250/atm/hist' + linkdir = '/glade/scratch/aliceb/b.e20.B1850.f09_g17.pi_control.all.250/atm/hist' + + if not os.path.exists(linkdir): + os.makedirs(linkdir) + + casename = 'b.e20.B1850.f09_g17.pi_control.all.250.cam.h0' + filename = '{0}.{1}-{2}.nc'.format(casename,year,month) + os.symlink(os.path.join(srcdir, filename), os.path.join(linkdir, filename)) + + +for year in ['0001','0002','0003','0004','0005','0006','0007','0008','0009','0010','0011','0012','0013','0014','0015']: + for month in ['01','02','03','04','05','06','07','08','09','10','11','12']: + + srcdir = '/glade/p/cesm0005/archive/b.e20.B1850.f09_g17.pi_control.all.250/lnd/hist' + linkdir = '/glade/scratch/aliceb/b.e20.B1850.f09_g17.pi_control.all.250/lnd/hist' + + if not os.path.exists(linkdir): + os.makedirs(linkdir) + + casename = 'b.e20.B1850.f09_g17.pi_control.all.250.clm2.h0' + filename = '{0}.{1}-{2}.nc'.format(casename,year,month) + os.symlink(os.path.join(srcdir, filename), os.path.join(linkdir, filename)) + + +for year in ['0001','0002','0003','0004','0005','0006','0007','0008','0009','0010','0011','0012','0013','0014','0015']: + for month in ['01','02','03','04','05','06','07','08','09','10','11','12']: + + srcdir = '/glade/p/cesm0005/archive/b.e20.B1850.f09_g17.pi_control.all.250/rof/hist' + linkdir = '/glade/scratch/aliceb/b.e20.B1850.f09_g17.pi_control.all.250/rof/hist' + + if not os.path.exists(linkdir): + os.makedirs(linkdir) + + casename = 'b.e20.B1850.f09_g17.pi_control.all.250.mosart.h0' + filename = '{0}.{1}-{2}.nc'.format(casename,year,month) + os.symlink(os.path.join(srcdir, filename), os.path.join(linkdir, filename)) + diff --git a/averager/pyAverager/README b/averager/pyAverager/README index bf32b8c7..906c8269 100644 --- a/averager/pyAverager/README +++ b/averager/pyAverager/README @@ -1,4 +1,4 @@ -October 26, 2017 +December 13, 2017 ====================================== @@ -9,7 +9,7 @@ PyAverager A package used for computing averages from climate model output. Authors: Sheri Mickelson, Kevin Paul, and John Dennis -Version: 0.9.12 +Version: 0.9.14 Copyright: Contained within LICENSE.txt Comments and feedback: mickelso@ucar.edu diff --git a/averager/pyAverager/pyaverager/PyAverager.py b/averager/pyAverager/pyaverager/PyAverager.py index 104710b5..323decc1 100755 --- a/averager/pyAverager/pyaverager/PyAverager.py +++ b/averager/pyAverager/pyaverager/PyAverager.py @@ -388,7 +388,7 @@ def compute_averages(self,spec): # The mean diff rsm function will send the variables once they are created var_avg_results,var_DIFF_results,var_RMS_results = climAverager.mean_diff_rms(var,region_name,region_num,spec.region_nc_var, spec.region_wgt_var,years,hist_dict,ave_t.average_types[ave_descr[0]],file_dict,obs_file, - reg_obs_file,inter_comm,spec.serial,VNAME_TAG,AVE_TAG,nlev) + reg_obs_file,inter_comm,spec.serial,VNAME_TAG,AVE_TAG,spec.vertical_levels) else: if ('__metaChar' in orig_var): # Handle special meta diff --git a/averager/pyAverager/pyaverager/__init__.py b/averager/pyAverager/pyaverager/__init__.py index f5382222..c9c29ec0 100644 --- a/averager/pyAverager/pyaverager/__init__.py +++ b/averager/pyAverager/pyaverager/__init__.py @@ -2,5 +2,5 @@ import PyAverager, specification, PreProc -__version__ = "0.9.12" +__version__ = "0.9.14" diff --git a/averager/pyAverager/pyaverager/climAverager.py b/averager/pyAverager/pyaverager/climAverager.py index 50954eec..a4d19a39 100644 --- a/averager/pyAverager/pyaverager/climAverager.py +++ b/averager/pyAverager/pyaverager/climAverager.py @@ -120,7 +120,10 @@ def avg_var_missing(var,years,hist_dict,ave_info,file_dict,ave_type,fillValue,ti pull_year = yr var_val = rover.fetch_slice(hist_dict,pull_year,m,var,file_dict) timer.stop("Variable fetch time") - var_filled = var_val.filled(fill_value=0) # zero out the masked grid points + if (hasattr(var_val, 'filled')): + var_filled = var_val.filled(fill_value=0) # zero out the masked grid points + else: + var_filled = np.ones(var_val.shape) # Get and add mask values to the mask accumulator if (first_mask): if (MA.any(MA.getmask(var_val))): @@ -282,8 +285,12 @@ def weighted_avg_var_missing(var,years,hist_dict,ave_info,file_dict,ave_type,fil else: pull_year = yr var_val = rover.fetch_slice(hist_dict,pull_year,m,var,file_dict) - timer.stop("Variable fetch time") - var_filled = var_val.filled(fill_value=0) # zero out the masked grid points + timer.stop("Variable fetch time") + + if (hasattr(var_val, 'filled')): + var_filled = var_val.filled(fill_value=0) # zero out the masked grid points + else: + var_filled = np.ones(var_val.shape) # Get and add mask values to the mask accumulator if (first_mask): if (MA.any(MA.getmask(var_val))): diff --git a/averager/pyAverager/pyaverager/climFileIO.py b/averager/pyAverager/pyaverager/climFileIO.py index 9d32e6a7..07221df5 100644 --- a/averager/pyAverager/pyaverager/climFileIO.py +++ b/averager/pyAverager/pyaverager/climFileIO.py @@ -443,7 +443,8 @@ def define_ave_file(l_master,serial,var_list,lvar_list,meta_list,hist_dict,hist_ # Add meta variables temp = {} for mv in meta_list: - temp[mv] = create_meta_var(my_file[first_fn],mv,new_file,collapse_dim) + if mv in my_file[first_fn].variables.keys(): + temp[mv] = create_meta_var(my_file[first_fn],mv,new_file,collapse_dim) all_files_vars = temp # Have each rank open it's own variable file(s), retreive variable info, and send to root to create variable @@ -515,7 +516,8 @@ def define_ave_file(l_master,serial,var_list,lvar_list,meta_list,hist_dict,hist_ all_files_vars.update(new_file.variables) # All vars are defined, Write all meta vars to the files for mv in meta_list: - write_meta(all_files_vars, mv, my_file[first_fn]) + if mv in my_file[first_fn].variables.keys(): + write_meta(all_files_vars, mv, my_file[first_fn]) return all_files_vars,new_file #============================================================================== diff --git a/averager/pyAverager/setup.py b/averager/pyAverager/setup.py index 4a908458..caf834dc 100644 --- a/averager/pyAverager/setup.py +++ b/averager/pyAverager/setup.py @@ -3,7 +3,7 @@ from distutils.core import setup setup(name='PyAverager', - version='0.9.12', + version='0.9.14', description='Parallel Python Averager for Climate Data', author='Sheri Mickelson', author_email='mickelso@ucar.edu', diff --git a/ocn_diag/ncl_lib/compute_rho_cntl.ncl b/ocn_diag/ncl_lib/compute_rho_cntl.ncl index 645d025a..a4d31c06 100644 --- a/ocn_diag/ncl_lib/compute_rho_cntl.ncl +++ b/ocn_diag/ncl_lib/compute_rho_cntl.ncl @@ -31,7 +31,7 @@ begin do n = 0, nt - 1 do k = 0, nz - 1 - print("month = " + (n+1) + " level = " + (k+1)) +;; print("month = " + (n+1) + " level = " + (k+1)) opt = False PD(n,k,:,:) = (eos(TEMP(n,k,:,:),SALT(n,k,:,:),0,opt) - 1.0d) * 1000.0d end do diff --git a/ocn_diag/ncl_lib/field_2d.ncl b/ocn_diag/ncl_lib/field_2d.ncl index 9be80966..dc81b0e5 100644 --- a/ocn_diag/ncl_lib/field_2d.ncl +++ b/ocn_diag/ncl_lib/field_2d.ncl @@ -4,11 +4,26 @@ load "$NCLPATH/get_environment.ncl" load "$NCLPATH/contour_plot.ncl" begin - field_name = [/"HMXL", "HBLT", "SU", "SV", "BSF" /] - +;; field_name = [/"HMXL", "HBLT", "SU", "SV", "BSF" /] + field_name = NewList("lifo") missing = 1.0e30 fileid = addfile(file_netcdf,"r") + if (isfilevar(fileid,"HMXL")) then + ListPush(field_name,"HMXL") + end if + if (isfilevar(fileid,"HBLT")) then + ListPush(field_name,"HBLT") + end if + if (isfilevar(fileid,"SU")) then + ListPush(field_name,"SU") + end if + if (isfilevar(fileid,"SV")) then + ListPush(field_name,"SV") + end if + if (isfilevar(fileid,"BSF")) then + ListPush(field_name,"BSF") + end if if (isfilevar(fileid,"DIA_DEPTH")) then ListPush(field_name,"DIA_DEPTH") end if diff --git a/ocn_diag/ncl_lib/sfcflx.ncl b/ocn_diag/ncl_lib/sfcflx.ncl index 08c85017..94fef6ed 100644 --- a/ocn_diag/ncl_lib/sfcflx.ncl +++ b/ocn_diag/ncl_lib/sfcflx.ncl @@ -5,11 +5,23 @@ load "$NCLPATH/contour_plot.ncl" load "$NCLPATH/curl_pop.ncl" begin -field_name = (/ "SHF", "SHF_TOTAL", "SHF_QSW", "MELTH_F", \ - "SENH_F", "LWUP_F", "LWDN_F", "EVAP_F", \ - "SFWF", "SFWF_TOTAL", "PREC_F", "MELT_F", \ - "ROFF_F", "SALT_F", "TAUX", "TAUY", "CURL", \ - "QFLUX", "SNOW_F" /) +print ( "resolution = " + resolution ) + +if (resolution .eq. "tx0.1v2") then + field_name = (/ "SHF", "MELTH_F", \ + "SENH_F", "LWUP_F", "LWDN_F", "EVAP_F", \ + "SFWF", "PREC_F", "MELT_F", \ + "ROFF_F", "SALT_F", "TAUX", "TAUY", \ + "SNOW_F" /) +else + field_name = (/ "SHF", "SHF_TOTAL", "SHF_QSW", "MELTH_F", \ + "SENH_F", "LWUP_F", "LWDN_F", "EVAP_F", \ + "SFWF", "SFWF_TOTAL", "PREC_F", "MELT_F", \ + "ROFF_F", "SALT_F", "TAUX", "TAUY", "CURL", \ + "QFLUX", "SNOW_F" /) +end if + + if ((resolution .eq. "gx1v6") .or. (resolution .eq. "gx1v7")) then obs_var_name = (/ "", "Foxx_nethflx", "Foxx_swnet", "", \ "Foxx_sen", "Foxx_lwup", "Foxx_lwdn","Foxx_evap", \ @@ -30,7 +42,6 @@ print( " the number of fields to be processed is " + n_fields) missing = default_fillvalue("float") - ;;print("file_netcdf = "+file_netcdf) ;;print("file_flux_obs = "+file_flux_obs) ;;print("file_wind_obs = "+file_wind_obs) @@ -93,7 +104,6 @@ do n = 0, n_fields-1 end if end if end if - if (field_name(n) .eq. "CURL") then if (obsvar .ne. "") then @@ -115,45 +125,55 @@ do n = 0, n_fields-1 field_obs@units = "10e-8N/m3" delete([/taux,tauy/]) - end if - taux = fileid->TAUX(0,:,:) - tauy = fileid->TAUY(0,:,:) - taux = tofloat(taux * cos(angle) + tauy * sin(-angle)) - taux = where(abs(taux) .gt. 1.0e10,taux@_FillValue, taux) - tauy = tofloat(tauy * cos(angle) - taux * sin(-angle)) - tauy = where(abs(tauy) .gt. 1.0e10,tauy@_FillValue, tauy) - k = 1 - field = curl_pop(k, taux, tauy, dxu, dyu, tarea, kmt, missing) - field = field/1.0e-8 - field@units = "10e-8N/m3" + end if + taux = fileid->TAUX(0,:,:) + tauy = fileid->TAUY(0,:,:) + taux = tofloat(taux * cos(angle) + tauy * sin(-angle)) + taux = where(abs(taux) .gt. 1.0e10,taux@_FillValue, taux) + tauy = tofloat(tauy * cos(angle) - taux * sin(-angle)) + tauy = where(abs(tauy) .gt. 1.0e10,tauy@_FillValue, tauy) + k = 1 + field = curl_pop(k, taux, tauy, dxu, dyu, tarea, kmt, missing) + field = field/1.0e-8 + field@units = "10e-8N/m3" else if (field_name(n) .eq. "SHF_TOTAL" ) then + if (isfilevar(fileid,"QFLUX")) then field_temp = fileid->QFLUX field_temp2 = fileid->SHF field = field_temp + field_temp2 + end if else if ( field_name(n) .eq. "SFWF_TOTAL" ) then + if (isfilevar(fileid,"QFLUX")) then field_temp = fileid->QFLUX field_temp2 = fileid->SFWF field = -field_temp/l_f + field_temp2 + end if else + if (isfilevar(fileid,field_name(n))) then field = fileid->$field_name(n)$ + else + field = _Missing + end if end if end if end if - if (iscoord(field,"ULONG")) then - ugrid = True - else - ugrid = False - end if - ;print(ugrid) + if (.not.all(ismissing(field))) then + if (iscoord(field,"ULONG")) then + ugrid = True + else + ugrid = False + end if + ;print(ugrid) - if (isatt(field,"units")) then - units = field@units - else - units = "" - end if - area = tarea - if ( field_name(n) .eq. "TAUX" ) then + if (isatt(field,"units")) then + units = field@units + else + units = "" + end if + + area = tarea + if ( field_name(n) .eq. "TAUX" ) then field_2 = fileid->TAUY ;printVarSummary(field_2) ;printVarSummary(angle) @@ -164,16 +184,16 @@ do n = 0, n_fields-1 area = uarea ; obsvar2 = obs_prefix + "Foxx_tauy" ; field_obs2 = obsfile->$obsvar2$ - if (obsvar .ne. "") then - field_obs = where(abs(field_obs) .gt. 1.0e10, field_obs@_FillValue, field_obs) - field_obs = field_obs * 10.0 + if (obsvar .ne. "") then + field_obs = where(abs(field_obs) .gt. 1.0e10, field_obs@_FillValue, field_obs) + field_obs = field_obs * 10.0 ; field_obs2 = where(abs(field_obs2) .gt. 1.0e10, field_obs2@_FillValue, field_obs2) ; field_obs2 = field_obs2 * 10.0 ; field_obs(0,:,:) = field_obs(0,:,:) * cos(angle) + field_obs2(0,:,:) * sin(-angle) ; delete(field_obs2) - end if + end if - else if (field_name(n) .eq. "TAUY" ) then + else if (field_name(n) .eq. "TAUY" ) then field_2 = fileid->TAUX field(0,:,:) = tofloat(field(0,:,:) * cos(angle) - field_2(0,:,:) * sin(-angle)) field = where(abs(field) .gt. 1.0e29, field@_FillValue, field) @@ -181,16 +201,16 @@ do n = 0, n_fields-1 area = uarea ; obsvar2 = obs_prefix + "Foxx_taux" ; field_obs2 = obsfile->$obsvar2$ - if (obsvar .ne. "") then - field_obs = where(abs(field_obs) .gt. 1.0e10, field_obs@_FillValue, field_obs) - field_obs = field_obs * 10.0 + if (obsvar .ne. "") then + field_obs = where(abs(field_obs) .gt. 1.0e10, field_obs@_FillValue, field_obs) + field_obs = field_obs * 10.0 ; field_obs2 = where(abs(field_obs2) .gt. 1.0e10, field_obs2@_FillValue, field_obs2) ; field_obs2 = field_obs2 * 10.0 ; field_obs(0,:,:) = field_obs(0,:,:) * cos(angle) - field_obs2(0,:,:) * sin(-angle) ; delete(field_obs2) + end if end if end if - end if dmin = missing dmax = missing @@ -384,7 +404,7 @@ do n = 0, n_fields-1 end if - if ( dmin .eq. missing .or. dmax .eq. missing ) then \ + if ( dmin .eq. missing .or. dmax .eq. missing ) then \ print( " user must set the contour limits .... " ) end if @@ -412,7 +432,7 @@ do n = 0, n_fields-1 print(" user must set the contour limits .... ") end if if (isatt(field,"units")) then - field_diff@units = field@units + field_diff@units = field@units end if end if @@ -460,27 +480,29 @@ do n = 0, n_fields-1 end if ;;print("drawing plot1") plot1 = contour_plot(wks, field, tlon, tlat, kmt, region_mask, area, case_info, \ - missing, units, dlev, lev, coltab, opt) + missing, units, dlev, lev, coltab, opt) if (opt@do_panel) then - ;;print("drawing plot2") - if (field_name(n) .eq. "CURL") then - opt@contourline = 2 - else - opt@contourline = 1 - end if - plot2 = contour_plot(wks, field_diff, tlon, tlat, kmt, region_mask, area, case_info_diff, \ - missing, units, dlev_diff, lev_diff, coltab, opt) + ;;print("drawing plot2") + if (field_name(n) .eq. "CURL") then + opt@contourline = 2 + else + opt@contourline = 1 + end if + plot2 = contour_plot(wks, field_diff, tlon, tlat, kmt, region_mask, area, case_info_diff, \ + missing, units, dlev_diff, lev_diff, coltab, opt) - ;;print("panelling") - gsn_panel(wks,(/plot1,plot2/), (/2,1/),False) - end if + ;;print("panelling") + gsn_panel(wks,(/plot1,plot2/), (/2,1/),False) + end if delete([/field,obsvar,lev,coltab/]) if (isvar("field_obs")) then delete([/field_obs,field_diff,lev_diff/]) end if + end if + end do end diff --git a/ocn_diag/ncl_lib/sfcflx_za.ncl b/ocn_diag/ncl_lib/sfcflx_za.ncl index b4656ae1..a586e00d 100644 --- a/ocn_diag/ncl_lib/sfcflx_za.ncl +++ b/ocn_diag/ncl_lib/sfcflx_za.ncl @@ -8,9 +8,9 @@ file_netcdf_za = "za_"+file_netcdf file_flux_obs_za = "za_"+file_flux_obs file_wind_obs_za = "za_"+file_wind_obs -;;print("*** file_netcdf_za = "+file_netcdf_za) -;;print("*** file_flux_obs_za = "+file_flux_obs_za) -;;print("*** file_wind_obs_za = "+file_wind_obs_za) +print("*** file_netcdf_za = "+file_netcdf_za) +print("*** file_flux_obs_za = "+file_flux_obs_za) +print("*** file_wind_obs_za = "+file_wind_obs_za) fileid = addfile(file_netcdf,"r") f_za = addfile(file_netcdf_za,"r") @@ -38,10 +38,17 @@ n_reg = dimsizes(region_index) varsinfile = getfilevarnames(f_za) if (any(varsinfile.eq."SHF") .and. any(varsinfile.eq."SFWF")) then - field_name = (/ "SHF", "SHF_QSW", "SFWF", "PREC_F", \ - "EVAP_F", "MELT_F", "ROFF_F", "SALT_F", \ - "SENH_F", "LWUP_F", "LWDN_F", "MELTH_F", \ - "QFLUX", "SNOW_F" /) + if (any(varsinfile.eq."QFLUX")) then + field_name = (/ "SHF", "SHF_QSW", "SFWF", "PREC_F", \ + "EVAP_F", "MELT_F", "ROFF_F", "SALT_F", \ + "SENH_F", "LWUP_F", "LWDN_F", "MELTH_F", \ + "QFLUX", "SNOW_F" /) + else + field_name = (/ "SHF", "SFWF", "PREC_F", \ + "EVAP_F", "MELT_F", "ROFF_F", "SALT_F", \ + "SENH_F", "LWUP_F", "LWDN_F", "MELTH_F", \ + "SNOW_F" /) + end if else field_name = (/ "SHF_TOTAL", "SHF_QSW", "SFWF_TOTAL", "PREC_F", \ "EVAP_F", "MELT_F", "ROFF_F", "SALT_F", \ @@ -55,7 +62,11 @@ if ((resolution .eq. "gx1v6") .or. (resolution .eq. "gx1v7")) then "sen", "lwup", "lwdn", "melth", \ "", "snow" /) else if (resolution .eq. "tx0.1v2") then - obsvar_name = (/ "swnet", "melth", "sen", \ + field_name = (/ "SHF", "SFWF", "PREC_F", \ + "EVAP_F", "MELT_F", "ROFF_F", "SALT_F", \ + "SENH_F", "LWUP_F", "LWDN_F", "MELTH_F", \ + "SNOW_F" /) + obsvar_name = (/ "swnet", "melth", "sen", \ "lwup", "lwdn", "evap", "rain", \ "meltw", "", "snow" /) else @@ -103,6 +114,8 @@ lat_t = f_za->lat_t do n=0, n_fields-1 + field = _Missing + if(.not.any(varsinfile.eq.field_name(n))) then print(field_name(n) + " is not in file.") continue @@ -146,11 +159,13 @@ do n=0, n_fields-1 field_name(n) .ne. "SHF" .and. \ field_name(n) .ne. "SFWF") then field = f_za->$field_name(n)$ + printVarSummary(field) else if ( field_name(n) .eq. "SHF_TOTAL" .or. \ - field_name(n) .eq. "SHF") then + field_name(n) .eq. "SHF" .and. \ + isfilevar(f_za,"QFLUX")) then ;; print("**************") -;; print("*** computing SHF_TOTAL") + print("*** computing SHF_TOTAL") field_q = f_za->QFLUX ;;field = f_za->SHF field = f_za->$field_name(n)$ @@ -159,9 +174,10 @@ do n=0, n_fields-1 ;; print("**************") end if if ( field_name(n) .eq. "SFWF_TOTAL" .or. \ - field_name(n) .eq. "SFWF") then + field_name(n) .eq. "SFWF" .and. \ + isfilevar(f_za,"QFLUX")) then ;; print("**************") -;; print("*** computing SFWF_TOTAL") + print("*** computing SFWF_TOTAL") field_q = f_za->QFLUX ;;field = f_za->SFWF field = f_za->$field_name(n)$ @@ -230,11 +246,12 @@ do n=0, n_fields-1 res@gsnPaperOrientation = "portrait" if (obsvar .eq. "") then - ; printVarSummary(field) - ;;print("*** plot with obsvar is null") + print("*** plot with obsvar is null") + printVarSummary(field) plot = gsn_csm_xy(wks,lat_t,field(0,global,:),res) - else - ;;print("*** plot with obsvar ="+obsvar) + else if (.not.all(ismissing(field))) then + print("*** plot with obsvar = "+obsvar) + printVarSummary(field) if (cpl .eq. 7) then data = new((/2,dimsizes(lat_t)/),double) else @@ -253,6 +270,7 @@ do n=0, n_fields-1 delete(data) delete(field_obs) end if + end if delete(field) end do diff --git a/ocn_diag/tool_lib/process_pop2_dtfiles.awk b/ocn_diag/tool_lib/process_pop2_dtfiles.awk index 03be50e5..0a9174b8 100755 --- a/ocn_diag/tool_lib/process_pop2_dtfiles.awk +++ b/ocn_diag/tool_lib/process_pop2_dtfiles.awk @@ -27,7 +27,7 @@ BEGIN { name = $5 name2 = $6 name3 = $7 - if (name == "Drake") { + if (name == "ACC-Drake" || name == "Drake") { if (! (deciyear in recordedthistime)) { ++timecnt recordedthistime[deciyear] = 1 diff --git a/timeseries/timeseries/chunking.py b/timeseries/timeseries/chunking.py index 243f2257..bd24aef1 100755 --- a/timeseries/timeseries/chunking.py +++ b/timeseries/timeseries/chunking.py @@ -4,9 +4,13 @@ import netCDF4 as nc import cf_units import datetime +import math from asaptools import partition def num2date(time_value, unit, calendar): +## fix for fractional time bounds + if (math.floor(time_value) != time_value): + time_value = int(round(time_value)) if ('common_year' in unit): my_unit = unit.replace('common_year', 'day') ## my_time_value = time_value * 365