Notebook
# create daily files, use data to initialize fields year=2016 fname='/data/eolson/MEOPAR/NEMO-forcing-new/rivers-climatology/bio/R201809_2_bioClim_' for yearday in range(1,367): t2=dt.date(year, 1, 1) + dt.timedelta(days = yearday - 1) #datestr='y'+t2.strftime('%Y')+'m'+t2.strftime('%m')+'d'+t2.strftime('%d') datestr='m'+t2.strftime('%m')+'d'+t2.strftime('%d') new=nc.Dataset(fname+datestr+'.nc','w') #Copy dimensions for dname, the_dim in f.dimensions.items(): #print (dname, len(the_dim) if not the_dim.isunlimited() else None) new.createDimension(dname, len(the_dim) if not the_dim.isunlimited() else None) #new_tc=new.createVariable('time_counter',float,('time_counter'),zlib=True) #new_tc[:]=f.variables['time_counter'][:] new_run=new.createVariable('no3',float,('time_counter', 'y', 'x'),zlib=True) new_run[:,:,:]=const_no # other river value new_run[:,400:520,380:]=no3dict[yearday]/mwN*1000.0 # convert to muM; Fraser value new_run=new.createVariable('sil',float,('time_counter', 'y', 'x'),zlib=True) new_run[:,:,:]=const_si # other river value new_run[:,400:520,380:]=sidict[yearday]/mwSiO2*1000.0 # convert to muM; Fraser value new.close()