An operation has been launched to refloat a stricken cargo ship which ran aground in rough seas in North Wales.