adding new functions for flatten and write
removing use of larg logicals for ds.rods