Get the variable ID for a named variable
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | ncid | |||
| character(len=*), | intent(in) | :: | name | |||
| integer, | intent(out) | :: | varid | |||
| integer, | intent(out), | optional | :: | ierr |
Non-zero (no matching variable) when present; absent behaves
as today ( |
subroutine nc_get_varid(ncid, name, varid, ierr) !! Get the variable ID for a named variable integer, intent(in) :: ncid character(len=*), intent(in) :: name integer, intent(out) :: varid integer, intent(out), optional :: ierr !! Non-zero (no matching variable) when present; absent behaves !! as today (`error stop`). call nc_check(nf90_inq_varid(ncid, name, varid), & "finding variable "//trim(name), ierr) end subroutine nc_get_varid