def write_members_to_netcdf (outfile, ncname, idate, cyyyymmddhh, \ cyyyymmddhh_fcst, precip_ens_raw_out, precip_ens_qmapped_out, \ ensmean_raw_out, ensmean_qmapped_out): from netCDF4 import Dataset """ write the raw and quantile-mapped ensemble probabilities to a netCDF file """ # ---- write probabilities and close print (' cyyyymmddhh, cyyyymmddhh_fcst = ', cyyyymmddhh, cyyyymmddhh_fcst) print (' writing probs to netCDF file ',outfile) nc_fullfield = Dataset(outfile,'a',format='NETCDF4_CLASSIC') nc_fullfield['yyyymmddhh_init'][idate] = int(cyyyymmddhh) nc_fullfield['yyyymmddhh_fcst'][idate] = int(cyyyymmddhh_fcst) nc_fullfield['precip_ens_raw'][idate] = precip_ens_raw_out[:,:,:] nc_fullfield['precip_ens_qmapped'][idate] = precip_ens_qmapped_out[:,:,:] nc_fullfield['ensmean_raw'][idate] = ensmean_raw_out[:,:] nc_fullfield['ensmean_qmapped'][idate] = ensmean_qmapped_out[:,:] nc_fullfield.close() istat = 0 return istat