NCEPLIBS-g2 4.0.0
All Data Structures Namespaces Files Functions Variables Pages
g2png.F90
Go to the documentation of this file.
1
6
33subroutine pngpack(fld, width, height, idrstmpl, cpack, lcpack)
34
35 use, intrinsic :: iso_c_binding, only: c_size_t
36 implicit none
37
38 integer, intent(in) :: width, height
39 real, intent(in) :: fld(width * height)
40 character(len = 1), intent(out) :: cpack(*)
41 integer, intent(inout) :: idrstmpl(*)
42 integer, intent(out) :: lcpack
43 integer(c_size_t) :: width_c, height_c
44 integer :: ret
45
46 interface
47 function g2c_pngpackd(fld, width, height, idrstmpl, cpack, lcpack) bind(c)
48 use, intrinsic :: iso_c_binding
49 real(kind=c_double), intent(in):: fld(*)
50 integer(c_size_t), value, intent(in) :: width, height
51 integer(c_int), intent(inout) :: idrstmpl(*)
52 character(kind=c_char), intent(out) :: cpack(*)
53 integer(c_int), intent(out) :: lcpack
54 integer(c_int) :: g2c_pngpackd
55 end function g2c_pngpackd
56 function g2c_pngpackf(fld, width, height, idrstmpl, cpack, lcpack) bind(c)
57 use, intrinsic :: iso_c_binding
58 real(kind=c_float), intent(in):: fld(*)
59 integer(c_size_t), value, intent(in) :: width, height
60 integer(c_int), intent(inout) :: idrstmpl(*)
61 character(kind=c_char), intent(out) :: cpack(*)
62 integer(c_int), intent(out) :: lcpack
63 integer(c_int) :: g2c_pngpackf
64 end function g2c_pngpackf
65 end interface
66
67 width_c = width
68 height_c = height
69
70#if KIND==4
71 ret = g2c_pngpackf(fld, width_c, height_c, idrstmpl, cpack, lcpack)
72#else
73 ret = g2c_pngpackd(fld, width_c, height_c, idrstmpl, cpack, lcpack)
74#endif
75
76end subroutine pngpack
77
94subroutine pngunpack(cpack, len, idrstmpl, ndpts, fld)
95
96 use, intrinsic :: iso_c_binding, only: c_size_t
97 implicit none
98
99 character(len = 1), intent(in) :: cpack(len)
100 integer, intent(in) :: ndpts, len
101 integer, intent(in) :: idrstmpl(*)
102 real, intent(out) :: fld(ndpts)
103 integer(c_size_t) :: ndpts_c, len_c
104 integer :: ret
105
106 interface
107 function g2c_pngunpackd(cpack, len, idrstmpl, ndpts, fld) bind(c)
108 use, intrinsic :: iso_c_binding
109 implicit none
110 integer(c_size_t), value, intent(in) :: len
111 integer(c_size_t), value, intent(in) :: ndpts
112 character(kind=c_char), intent(in) :: cpack(*)
113 integer(c_int), intent(in) :: idrstmpl(*)
114 real(kind=c_double), intent(out) :: fld(*)
115 integer(c_int) :: g2c_pngunpackd
116 end function g2c_pngunpackd
117 function g2c_pngunpackf(cpack, len, idrstmpl, ndpts, fld) bind(c)
118 use, intrinsic :: iso_c_binding
119 implicit none
120 integer(c_size_t), value, intent(in) :: len
121 integer(c_size_t), value, intent(in) :: ndpts
122 character(kind=c_char), intent(in) :: cpack(*)
123 integer(c_int), intent(in) :: idrstmpl(*)
124 real(kind=c_float), intent(out) :: fld(*)
125 integer(c_int) :: g2c_pngunpackf
126 end function g2c_pngunpackf
127 end interface
128
129 len_c = len
130 ndpts_c = ndpts
131#if KIND==4
132 ret = g2c_pngunpackf(cpack, len_c, idrstmpl, ndpts_c, fld)
133#else
134 ret = g2c_pngunpackd(cpack, len_c, idrstmpl, ndpts_c, fld)
135#endif
136
137end subroutine pngunpack
subroutine pngunpack(cpack, len, idrstmpl, ndpts, fld)
Unpack a data field with PNG, defined in [Data Representation Template 5.40](https://www....
Definition g2png.F90:95
subroutine pngpack(fld, width, height, idrstmpl, cpack, lcpack)
Pack a data field into PNG image format, defined in [Data Representation Template 5....
Definition g2png.F90:34