Tuesday, March 31, 2015

Split Granule name to find the match

I wanted the MODIS granule name from the long list of MYD35_L2. The year and daynum-hhmmss etc mattered so that I could do a pattern match.
This is an easy fix.
  [token, remain] = strsplit(scene5a{i}, 'MYD35_L2.A');
  modname = token{2};
  ahr = str2double(modname(9:10));
  amin = str2double(modname(11:12));
  mday = str2double(modname(5:7));
  year =  str2double(modname(1:4));
  obsday = yearday(year,mday);
  dofm = str2double(datestr(obsday,7));
  mth = str2double(datestr(obsday,5));
  MODobs(c) = datenum(year,mth,dofm,ahr,amin,0);

No comments: