Re: cutting a string

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon Oct 14 2013 - 13:00:14 MDT

Did you look at any of NCL's string functions?

http://www.ncl.ucar.edu/

Click "Functions" at the top

Click "Category" ===> Under 'General NCL routines', Click "String"

                        1 2 3 4 5
              0123456789012345678901234567890123456789012345678901234
  fil_name = "ts_Amon_ACCESS1-0_historicalrcp45_r1i1p1_185001-210012.nc"
  mdl_name = str_get_cols(fil_name, 8, 16)
  ymStrt = str_get_cols(fil_name, 41, 46)
  ymLast = str_get_cols(fil_name, 48, 53)

On 10/14/13 12:16 PM, Mahesh Varma wrote:
> Hello,
> I was just wondering if there is a way in NCL to cut a string. I have a
> string which is something like
> "/Volumes/HD2/CMIP5/Ext/combined_files/ts/ts_Amon_ACCESS1-0_historical-rcp45_r1i1p1_185001-210012.nc".
> I would like to extract the model name (in this case it is "ACCESS1-0") and
> the starting and ending date ( in this case starting date is 185001 and
> ending date is 210012) from this string. I tried using the cut command with
> systemfunc but was not successful. Any help will be appreciated.
> Thanks,
> Mahesh
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Oct 14 13:00:25 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 22 2013 - 10:35:27 MDT