[ncl-talk] To split nc file based on timestamp

Karl-Hermann Wieners karl-hermann.wieners at mpimet.mpg.de
Wed Jul 3 00:57:42 MDT 2019


Hi Tripura,

both Dennis' and my proposal will split the file at each time step, but
will not look into the actual time stamp data.

Best,
Karl

On 7/3/19 4:25 AM, Tripura Yerrapothu wrote:
> Hi Karl-Hermann
>
> Will his command split the files based on times stamps. Thank you in
> advance.
>
> Best Regards
> Bala Tripura Sundari
>
> On Tue, 2 Jul 2019 at 4:02 PM, Karl-Hermann Wieners
> <karl-hermann.wieners at mpimet.mpg.de
> <mailto:karl-hermann.wieners at mpimet.mpg.de>> wrote:
>
>
>       cdo splitsel,1 rtma_20190501_T_interp_test.nc
>     rtma_20190501_T_interp_test
>      
>

On 7/2/19 11:29 PM, Dennis Shea via ncl-talk wrote:
> One approach: direct use of netCDF operators [ NCO ]:*
> *
> *
> *
> *%>* ncks -d time,0  z.nc <http://z.nc>  z_0.nc <http://z_0.nc>
> *%>* ncks -d time,1  z.nc <http://z.nc>  z_1.nc <http://z_1.nc>
> etc
> ===
> I speculate the Climate Data Operators [CDO] could be used also
> ====
>
> Use (say) an NCL script to invoke the 'ncks' operator
> ====
>   diri = "./"         ; source input directory
>   fili = "z.nc <http://z.nc>"       ; source input file
>   pthi = diri+fili
>
>   diro = "./"         ; output directory
>
>   do nt=0,4
>      nts  = sprinti("%0.1i", nt)    ; or ... sprinti("%0.2i", nt)
>      filo = "z_"+nts+".nc"
>      ptho = diro+filo
>      nco  = "ncks -O -d time,"+nt+" "+pthi+" "+ptho
>      print("nt="+nt+": "+nco)                                      ;
> echo NCO command
>      system(nco)
>   end do
>



More information about the ncl-talk mailing list