Institute for Advanced Biosciences Keio University
MathDAMP Mathematica package for differential analysis of metabolite profiles
Home Overview Examples Downloads TriDAMP References Contact
MathDAMP > Examples > MathDAMP source > Data Import/Export > CDF format

CDF format

DAMPImportCDF[filename,options] function imports NetCDF data and processes it into MathDAMP internal format. The function was not tested thoroughly with NetCDF format files from different sources and may therefore not be generic. The option Resolution specifies the data binning along the m/z axis.

CDFnctypesizes = {"Byte"1, "Character8"1, "Integer16"2, "Real64"8, _4} ;

CDFReadPadded[st_, nctp_, len_] := Module[{rslt}, rslt = BinaryRead[st, Table[nctp,  ... [#4, 0, #] &[4 - Mod[len (nctp/.CDFnctypesizes), 4]]] ; rslt] <br />

CDFReadString[st_] := Module[{strlen}, strlen = BinaryRead[st, "UnsignedInteger ... ;1] ; StringJoin @@ CDFReadPadded[st, "Character8", strlen] ] 

CDFReadDimArrayElem[st_] := Module[{},  {CDFReadString[st], BinaryRead[st, "UnsignedInteger32", ByteOrdering1]} ] <br />

CDFnctypes = {1"Byte", 2"Character8", 3"Int ... 2754;"Integer32", 5"Real32", 6"Real64"} ; 

CDFReadAttArrayElem[st_] := Module[{nm, nctype, nelems}, nm = CDFReadString[st] ; &# ... Ordering1] ;  {nm, nctype, CDFReadPadded[st, nctype, nelems]} ] 

CDFReadAttArray[st_] := Module[{attarraymagic, attarraynelems}, attarraymagic = Bina ... 62754;1] ; Table[CDFReadAttArrayElem[st], {attarraynelems}] ] ] 

CDFReadVarArrayElem[st_] := Module[{nm, nelems, dimids, vattarray}, nm = CDFReadStri ... ering1], BinaryRead[st, "UnsignedInteger32", ByteOrdering1]} ]

Options[DAMPImportCDF] = {Global`Resolution1.} 

DAMPImportCDF[filename_, opts___] := Module[{resol, strm, magic, versionbyte, numrecs, dimar ... uot;&] 〚1, 3〛, -1]}} ; ] ; Close[strm] ; rslt]