PageRenderTime 61ms CodeModel.GetById 7ms RepoModel.GetById 1ms app.codeStats 0ms

/wrfv2_fire/external/io_grib1/WGRIB/pds4.h

http://github.com/jbeezley/wrf-fire
C++ Header | 90 lines | 65 code | 15 blank | 10 comment | 12 complexity | 8e2dce4913a205682504f929b426068e MD5 | raw file
Possible License(s): AGPL-1.0
  1. /* version 3.4 of grib headers w. ebisuzaki */
  2. /* this version is incomplete */
  3. /* add center DWD Helmut P. Frank */
  4. /* 10/02 add center CPTEC */
  5. #ifndef INT2
  6. #define INT2(a,b) ((1-(int) ((unsigned) (a & 0x80) >> 6)) * (int) (((a & 0x7f) << 8) + b))
  7. #endif
  8. #define PDS_Len1(pds) (pds[0])
  9. #define PDS_Len2(pds) (pds[1])
  10. #define PDS_Len3(pds) (pds[2])
  11. #define PDS_LEN(pds) ((int) ((pds[0]<<16)+(pds[1]<<8)+pds[2]))
  12. #define PDS_Vsn(pds) (pds[3])
  13. #define PDS_Center(pds) (pds[4])
  14. #define PDS_Model(pds) (pds[5])
  15. #define PDS_Grid(pds) (pds[6])
  16. #define PDS_HAS_GDS(pds) ((pds[7] & 128) != 0)
  17. #define PDS_HAS_BMS(pds) ((pds[7] & 64) != 0)
  18. #define PDS_PARAM(pds) (pds[8])
  19. #define PDS_L_TYPE(pds) (pds[9])
  20. #define PDS_LEVEL1(pds) (pds[10])
  21. #define PDS_LEVEL2(pds) (pds[11])
  22. #define PDS_KPDS5(pds) (pds[8])
  23. #define PDS_KPDS6(pds) (pds[9])
  24. #define PDS_KPDS7(pds) ((int) ((pds[10]<<8) + pds[11]))
  25. /* this requires a 32-bit default integer machine */
  26. #define PDS_Field(pds) ((pds[8]<<24)+(pds[9]<<16)+(pds[10]<<8)+pds[11])
  27. #define PDS_Year(pds) (pds[12])
  28. #define PDS_Month(pds) (pds[13])
  29. #define PDS_Day(pds) (pds[14])
  30. #define PDS_Hour(pds) (pds[15])
  31. #define PDS_Minute(pds) (pds[16])
  32. #define PDS_ForecastTimeUnit(pds) (pds[17])
  33. #define PDS_P1(pds) (pds[18])
  34. #define PDS_P2(pds) (pds[19])
  35. #define PDS_TimeRange(pds) (pds[20])
  36. #define PDS_NumAve(pds) ((int) ((pds[21]<<8)+pds[22]))
  37. #define PDS_NumMissing(pds) (pds[23])
  38. #define PDS_Century(pds) (pds[24])
  39. #define PDS_Subcenter(pds) (pds[25])
  40. #define PDS_DecimalScale(pds) INT2(pds[26],pds[27])
  41. /* old #define PDS_Year4(pds) (pds[12] + 100*(pds[24] - (pds[12] != 0))) */
  42. #define PDS_Year4(pds) (pds[12] + 100*(pds[24] - 1))
  43. /* various centers */
  44. #define NMC 7
  45. #define ECMWF 98
  46. #define DWD 78
  47. #define CMC 54
  48. #define CPTEC 46
  49. /* ECMWF Extensions */
  50. #define PDS_EcLocalId(pds) (PDS_LEN(pds) >= 41 ? (pds[40]) : 0)
  51. #define PDS_EcClass(pds) (PDS_LEN(pds) >= 42 ? (pds[41]) : 0)
  52. #define PDS_EcType(pds) (PDS_LEN(pds) >= 43 ? (pds[42]) : 0)
  53. #define PDS_EcStream(pds) (PDS_LEN(pds) >= 45 ? (INT2(pds[43], pds[44])) : 0)
  54. #define PDS_EcENS(pds) (PDS_LEN(pds) >= 52 && pds[40] == 1 && \
  55. pds[43] * 256 + pds[44] == 1035 && pds[50] != 0)
  56. #define PDS_EcFcstNo(pds) (pds[50])
  57. #define PDS_EcNoFcst(pds) (pds[51])
  58. /* NCEP Extensions */
  59. #define PDS_NcepENS(pds) (PDS_LEN(pds) >= 44 && pds[25] == 2 && pds[40] == 1)
  60. #define PDS_NcepFcstType(pds) (pds[41])
  61. #define PDS_NcepFcstNo(pds) (pds[42])
  62. #define PDS_NcepFcstProd(pds) (pds[43])
  63. /* time units */
  64. #define MINUTE 0
  65. #define HOUR 1
  66. #define DAY 2
  67. #define MONTH 3
  68. #define YEAR 4
  69. #define DECADE 5
  70. #define NORMAL 6
  71. #define CENTURY 7
  72. #define HOURS3 10
  73. #define HOURS6 11
  74. #define HOURS12 12
  75. #define SECOND 254