I have the foll. strings in python:
Vladimir_SW_crop_mask_ERA.hdr
Ust_Ordynskiy_Buryatskiy_AO_SW_crop_mask_ERA.hdr
Ingush_WW_crop_mask.dat
I want to parse these strings such that:
Get the crop type which can be either SW or WW
Get the region name which is the text preceding _SW or _WW
I was doing str.split('_')[0] to get region name, but that fails in case of Ust_Ordynskiy_Buryatskiy_AO_SW_crop_mask_ERA.hdr, where the region name is Ust_Ordynskiy_Buryatskiy_AO