Giter Club home page Giter Club logo

Comments (6)

xandrd avatar xandrd commented on September 21, 2024

UNITS attribute is supported by the tplot2cdf. You can store the pointer to the attribute structure via s.CDF.VARS.attrptr.

Could you give an example (a crib) when COORDINATE_SYSTEM are included into the tplot variable?

from bleeding_edge.

xandrd avatar xandrd commented on September 21, 2024

Note, you can add COORDINATE_SYSTEM with the current functionality:

; Adding cdf structure
tplot_add_cdf_structure, 'array_variable'
get_data, 'array_variable', limits=s

cdf_y_attr_struct = *s.CDF.VARS.attrptr

; Adding units
cdf_y_attr_struct.UNITS = 'arb. unit.'

; Adding coordinate system (`str_element` must be used because it is not a default field)
str_element,cdf_y_attr_struct,'COORDINATE_SYSTEM','arb. coord. system.',/add

; Save CDF structure into tplot variable
s.CDF.VARS.attrptr = ptr_new(cdf_y_attr_struct)
options,'array_variable','CDF', s.CDF

; Save cdf file
tplot2cdf, filename='example_array_variable_w_attibutes', tvars='array_variable'

from bleeding_edge.

xandrd avatar xandrd commented on September 21, 2024

@jameswilburlewis, could you provide a crib sheet or an example of saving coordinate system and units into the tplot variable?

Is there a general rule how we should deal with metadata in tplot variables?

from bleeding_edge.

jameswilburlewis avatar jameswilburlewis commented on September 21, 2024

Here's a test routine illustrating the issue:

pro repro_data_att
   timespan,'2007-03-23',1,/day
   thm_load_state,probe='a'
   get_data,'tha_state_pos',dl=dl
   help,dl.data_att  ; initialized when data is loaded 
   tplot2cdf,filename='tp_data_att_test.cdf',tvars=['tha_state_pos'],/default_cdf_structure
   del_data,'*'
   spd_cdf2tplot,'tp_data_att_test.cdf'
   get_data,'tha_state_pos',dl=dl
   help,dl.cdf.vatt.units
   help,dl.cdf.vatt.coordinate_system  ; missing, should be copied from data_att.coord_sys of stored variable
end

Last few lines of output:

TPLOT2CDF_SAVE_VARS(64): Open CDF file tp_data_att_test.cdf (id :   624444720)
TPLOT2CDF_SAVE_VARS(216): CDF file tp_data_att_test.cdf is closed
STORE_DATA(180): Deleted            2 variables
SPD_MMS_CDF_LOAD_VARS(232): Loading file: "tp_data_att_test.cdf"
STORE_DATA(314): Creating tplot variable: 1 tha_state_pos
<Expression>    STRING    = 'km'
% Tag name COORDINATE_SYSTEM is undefined for structure <Anonymous>.
% Execution halted at: REPRO_DATA_ATT     11 C:\Users\james\Desktop\spdsoft_trunk\projects\themis\spin\repro_data_att.pro
%                      $MAIN$          

If data_att.coord_sys is present in the saved tplot variable, it should be written to the coordinate_system attribute in the CDF. data_att.coord_sys gets updated during cotrans operations, so it should supersede whatever might be in cdf.vatt.coordinate_system.

from bleeding_edge.

xandrd avatar xandrd commented on September 21, 2024

Should spd_extract_tvar_metadata provide coordinate system as a metadata?

from bleeding_edge.

xandrd avatar xandrd commented on September 21, 2024

Coordinate system support was added to tplot_add_cdf_structure.

from bleeding_edge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.