@@ -36,7 +36,7 @@ program demo_loadtxt
36
36
use stdlib_io, only: loadtxt
37
37
implicit none
38
38
real, allocatable :: x(:,:)
39
- call loadtxt('example.dat', x)
39
+ call loadtxt('example.dat', x)
40
40
end program demo_loadtxt
41
41
```
42
42
@@ -128,6 +128,98 @@ program demo_savetxt
128
128
use stdlib_io, only: savetxt
129
129
implicit none
130
130
real :: x(3,2) = 1
131
- call savetxt('example.dat', x)
131
+ call savetxt('example.dat', x)
132
132
end program demo_savetxt
133
133
```
134
+
135
+
136
+ ## ` load_npy `
137
+
138
+ ### Status
139
+
140
+ Experimental
141
+
142
+ ### Description
143
+
144
+ Loads an ` array ` from a npy formatted binary file.
145
+
146
+ ### Syntax
147
+
148
+ ` call [[stdlib_io_npy(module):load_npy(interface)]](filename, array[, iostat][, iomsg]) `
149
+
150
+ ### Arguments
151
+
152
+ ` filename ` : Shall be a character expression containing the file name from which to load the ` array ` .
153
+ This argument is ` intent(in) ` .
154
+
155
+ ` array ` : Shall be an allocatable array of any rank of type ` real ` , ` complex ` or ` integer ` .
156
+ This argument is ` intent(out) ` .
157
+
158
+ ` iostat ` : Default integer, contains status of loading to file, zero in case of success.
159
+ It is an optional argument, in case not present the program will halt for non-zero status.
160
+ This argument is ` intent(out) ` .
161
+
162
+ ` iomsg ` : Deferred length character value, contains error message in case ` iostat ` is non-zero.
163
+ It is an optional argument, error message will be dropped if not present.
164
+ This argument is ` intent(out) ` .
165
+
166
+ ### Return value
167
+
168
+ Returns an allocated ` array ` with the content of ` filename ` in case of success.
169
+
170
+ ### Example
171
+
172
+ ``` fortran
173
+ program demo_loadnpy
174
+ use stdlib_io_npy, only: load_npy
175
+ implicit none
176
+ real, allocatable :: x(:,:)
177
+ call loadtxt('example.npy', x)
178
+ end program demo_loadnpy
179
+ ```
180
+
181
+
182
+ ## ` save_npy `
183
+
184
+ ### Status
185
+
186
+ Experimental
187
+
188
+ ### Description
189
+
190
+ Saves an ` array ` into a npy formatted binary file.
191
+
192
+ ### Syntax
193
+
194
+ ` call [[stdlib_io_npy(module):save_npy(interface)]](filename, array[, iostat][, iomsg]) `
195
+
196
+ ### Arguments
197
+
198
+ ` filename ` : Shall be a character expression containing the name of the file that will contain the ` array ` .
199
+ This argument is ` intent(in) ` .
200
+
201
+ ` array ` : Shall be an array of any rank of type ` real ` , ` complex ` or ` integer ` .
202
+ This argument is ` intent(in) ` .
203
+
204
+ ` iostat ` : Default integer, contains status of saving to file, zero in case of success.
205
+ It is an optional argument, in case not present the program will halt for non-zero status.
206
+ This argument is ` intent(out) ` .
207
+
208
+ ` iomsg ` : Deferred length character value, contains error message in case ` iostat ` is non-zero.
209
+ It is an optional argument, error message will be dropped if not present.
210
+ This argument is ` intent(out) ` .
211
+
212
+ ### Output
213
+
214
+ Provides a npy file called ` filename ` that contains the rank-2 ` array ` .
215
+
216
+ ### Example
217
+
218
+ ``` fortran
219
+ program demo_savenpy
220
+ use stdlib_io_npy, only: save_npy
221
+ implicit none
222
+ real :: x(3,2) = 1
223
+ call save_npy('example.npy', x)
224
+ end program demo_savenpy
225
+ ```
0 commit comments