pro mvn_lpw_cdf_write, varlist=varlist, dir=dir, cdf_filename=cdf_filename ;+ ;pro mvn_lpw_cdf_write, varlist, dir=dir ; ;Program written by Chris Fowler on Oct 15th 2013 to create a CDF file from one tplot variable. ;The required tplot variables must be read into IDL (using for example the r_header software) before ;running this routine. ; ;NOTE: caps are important in tplot names and must be included when present! ; ; INPUTS: ; - varlist is a string, or string array, from tplot_names, of tplot variables which have been loaded into IDL memory. ; - dir is a string and is the base directory where the CDF files will be saved. The individual file names ; are written within the routine and are the tplot variable names. ; - cdf_filename is an optional string. If set, the CDF filename will have the name 'cdf_filename'. If not set, the saved cdf file will ; be named using the tplot variable name only. The extension '.cdf' does not need to be included - it will be added automatically (the routine ; will still work even if it is included). ; ; OUTPUTS: ; - One CDF file per input tplot variable specified in varlist, containing the corresponding data, limit and dlimit information ; for each tplot variable. Save diretory is either the default or can be user specified in the keyword dir. ; ; KEYWORDS: ; - See INPUTS. ; ; EXAMPLES: ; - mvn_lpw_cdf_write, varlist='mvn_lpw_pas_V1', dir='/Users/MAVEN_example/' => produces the file /Users/MAVEN_example/mvn_lpw_pas_V1.cdf ; ; - mvn_lpw_cdf_write, varlist=['mvn_lpw_pas_V1', 'mvn_lpw_pas_V2'], dir='/Users/MAVEN_example/' => produces the files ; /Users/MAVEN_example/mvn_lpw_pas_V1.cdf and /Users/MAVEN_example/mvn_lpw_pas_V1.cdf. ; ; - mvn_lpw_cdf_write, dir='/Users/MAVEN_example/', varlist='mvn_lpw_euv', cdf_filename='