Reputation: 67
I need to move 'standard_name' to be the first attribute present in all my variables within a netcdf file.
I am yet to find the correct command but I am hoping it will be something fairly straight forward using NCO.
If I ncdump, this is the current output:
short heading(time) ;
heading:data_max = 359.88f ;
heading:long_name = "Ship heading" ;
heading:data_min = 0.f ;
heading:units = "degrees" ;
heading:missing_value = 1.e+38f ;
heading:add_offset = 179.94f ;
heading:standard_name = "ship_heading" ;
heading:scale_factor = -0.005491668f ;
short depth(time, depth) ;
depth:positive = "down" ;
depth:long_name = "Depth" ;
depth:data_min = 20.48f ;
depth:units = "meter" ;
depth:missing_value = 1.e+38f ;
depth:data_max = 572.5f ;
depth:standard_name = "depth" ;
depth:add_offset = 296.49f ;
depth:scale_factor = -0.008423671f ;
I need the output to be :
short heading(time) ;
**heading:standard_name = "ship_heading" ;**
heading:data_max = 359.88f ;
heading:long_name = "Ship heading" ;
heading:data_min = 0.f ;
heading:units = "degrees" ;
heading:missing_value = 1.e+38f ;
heading:add_offset = 179.94f ;
heading:scale_factor = -0.005491668f ;
short depth(time, depth) ;
**depth:standard_name = "depth" ;**
depth:positive = "down" ;
depth:long_name = "Depth" ;
depth:data_min = 20.48f ;
depth:units = "meter" ;
depth:missing_value = 1.e+38f ;
depth:data_max = 572.5f ;
depth:add_offset = 296.49f ;
depth:scale_factor = -0.008423671f ;
Upvotes: 1
Views: 1121
Reputation: 6342
I agree that the ideal place for standard_name
is as the first or second attribute. Dumps are much more legible that way. You need to understand that attributes are stored and dumped in the order of their creation. NCO has no feature to re-arrange this order. The best solution is to alter the dataset writer so it creates standard_name
before all other attributes. Or you can do something crazy like use ncatted
to delete all the attributes and then re-add them in your desired order.
Upvotes: 5