toJmaIntensity static method

JmaIntensity toJmaIntensity({
  1. required num? intensity,
})

リアルタイム震度から気象庁震度階級に変換

Implementation

static JmaIntensity toJmaIntensity({required num? intensity}) {
  if (intensity == null) {
    return JmaIntensity.unknown;
  } else {
    if (intensity < 0.5) {
      return JmaIntensity.int0;
    }
    if (intensity < 1.5) {
      return JmaIntensity.int1;
    }
    if (intensity < 2.5) {
      return JmaIntensity.int2;
    }
    if (intensity < 3.5) {
      return JmaIntensity.int3;
    }
    if (intensity < 4.5) {
      return JmaIntensity.int4;
    }
    if (intensity < 5.0) {
      return JmaIntensity.int5Lower;
    }
    if (intensity < 5.5) {
      return JmaIntensity.int5Upper;
    }
    if (intensity < 6.0) {
      return JmaIntensity.int6Lower;
    }
    if (intensity < 6.5) {
      return JmaIntensity.int6Upper;
    }
    return JmaIntensity.int7;
  }
}