@@ -227,6 +227,7 @@ impl<'f> GroupMut<'f> {
227
227
let ( ncid, name) = super :: group:: get_parent_ncid_and_stem ( self . id ( ) , name) ?;
228
228
VariableMut :: add_from_str ( ncid, & T :: type_descriptor ( ) , name, dims)
229
229
}
230
+
230
231
/// Adds a variable from a set of unique identifiers, recursing upwards
231
232
/// from the current group if necessary.
232
233
pub fn add_variable_from_identifiers < ' g , T > (
@@ -269,6 +270,20 @@ impl<'f> GroupMut<'f> {
269
270
} ;
270
271
super :: variable:: add_variable_from_identifiers ( ncid, name, dims, xtype)
271
272
}
273
+
274
+ /// Create a Variable containing strings into the dataset, with no data written into it
275
+ ///
276
+ /// Dimensions are identified using the name of the dimension, and will recurse upwards
277
+ /// if not found in the current group.
278
+ pub fn add_string_variable (
279
+ & mut self ,
280
+ name : & str ,
281
+ dims : & [ & str ] ,
282
+ ) -> error:: Result < VariableMut < ' f > > {
283
+ let typ = crate :: types:: NcVariableType :: String ;
284
+ let ( ncid, name) = super :: group:: get_parent_ncid_and_stem ( self . id ( ) , name) ?;
285
+ VariableMut :: add_from_str ( ncid, & typ, name, dims)
286
+ }
272
287
}
273
288
274
289
pub ( crate ) fn groups_at_ncid < ' f > ( ncid : nc_type ) -> error:: Result < impl Iterator < Item = Group < ' f > > > {
0 commit comments