Convert a unit string into value (m)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string |
function unit2IUf(string) result (met) !! Convert a unit string into value (m) implicit none real(kind=R8) :: met character(*), intent(in) :: string select case(string) case('m') met = 1.e+00_R8 case('cm') met = 1.e-02_R8 case('mm') met = 1.e-03_R8 case('µm') met = 1.e-06_R8 case('µ') met = 1.e-06_R8 case('nm') met = 1.e-09_R8 case('pm') met = 1.e-12_R8 case('Pa') met = 1.e+00_R8 case('MP') met = 1.e+06_R8 case('GP') met = 1.e+09_R8 case default if ( string(1:1) == '%' ) then met = 1.e-02_R8 else met = 1 endif endselect return endfunction unit2IUf