################################################################################ # # # Unless further variables or options for existing variables are introduced, # # DO NOT MODIFY this file! This is only a helper file! # # # ################################################################################ # # # This file does the actual work of selecting and reading in the RAW # # atmosphere data for Mars as specified by the user. For user specification # # use, e.g., DemoMarsAtmo1D.arts (or its 3D equivalent) as template. The # # template also contains the detailed information on which indices are linked # # to which specific value/selection for each of the variables. The full # # arrays, which the indices refer to and from which the actual values are # # extracted, are defined in atmo_mars.arts (hence, atmo_mars.arts needs to be # # included before the file at hand). # # # # This file expects the following input parameters: # # Ls (Index) The season of the atmospheric scenario. # # daytime (Index) The daytime of the atmospheric scenario. # # dust (Index) The dust loading of the atmospheric # # scenario. # # solar (Index) The solar activity level of the # # atmospheric scenario. # # basespecies (ArrayOfIndex) The abs_species to use (includes only # # such with on/off options only). # # h2ospecies (ArrayOfIndex) H2O setup selected (off/low/medium/high). # # hdospecies (ArrayOfIndex) HDO setup selected # # (off/low/medium/high/uncorrected). # # Necase (ArrayOfIndex) Electron density setup selected # # (off/different sza-dependencies). # # # # Files to be included before this file: # # includes/mars/atmo_mars.arts # # includes/common/createvars.arts # # # # It provides following output: # # z_field_raw as the WSV # # t_field_raw as the WSV # # vmr_field_raw as the WSV # # abs_species as the WSV # # # ################################################################################ Arts2 { # We will need to dummy-store some data in files to be able to export data from # forloops. So we create some dummy names. StringSet( tmpformat, "binary" ) StringSet( vmrtmp, "vmrtmp_mars.xml" ) StringSet( abstmp, "abstmp_mars.xml" ) # Get data for abs_species, where filenames do follow the basic convention #(filename=speciesname.xml) AgendaCreate( speciesloop_agenda ) AgendaSet( speciesloop_agenda ){ ReadXML( out=vmr_field_raw, filename=vmrtmp ) Extract( strtmp, casearray, forloop_index ) Append( specfilename, strtmp ) # Print( specfilename, 0 ) ReadXML( gf3tmp, specfilename ) Append( vmr_field_raw, gf3tmp ) WriteXML( output_file_format=tmpformat, in=vmr_field_raw, filename=vmrtmp ) } # Get data for abs_species, where filenames do NOT follow the basic convention AgendaCreate( subspeciesloop_agenda ) AgendaSet( subspeciesloop_agenda ){ ReadXML( out=vmr_field_raw, filename=vmrtmp ) ReadXML( out=abs_species, filename=abstmp ) abs_speciesAdd( species=speciesname ) Extract( strtmp, casearray, forloop_index ) Append( specfilename, strtmp ) # Print( specfilename, 0 ) ReadXML( gf3tmp, specfilename ) Append( vmr_field_raw, gf3tmp ) WriteXML( output_file_format=tmpformat, in=vmr_field_raw, filename=vmrtmp ) WriteXML( output_file_format=tmpformat, in=abs_species, filename=abstmp ) } # Read the atmospheric raw data # --- # first, create the casename string down to the common filename part in the # scenario folder. Data is located in: # Mars.Ls.daytime.dust/ # Mars.Ls.daytime.dust.solar/ # Mars.Ls.daytime.dust.solar.[variable.xml] Copy( superatmo, atmobase ) # construct upper level path name (Mars.Ls.daytime.dust) StringSet( atmostr, "Mars" ) StringSet( strtmp, "." ) Append( atmostr, strtmp ) Extract( subatmo, Lsarray, Ls ) Append( atmostr, subatmo ) Append( atmostr, strtmp ) Extract( subatmo, daytimearray, daytime ) Append( atmostr, subatmo ) Append( atmostr, strtmp ) Extract( subatmo, dustarray, dust ) Append( atmostr, subatmo ) # append upper level path name (Mars.Ls.daytime.dust) to base path Append( superatmo, atmostr ) StringSet( strtmp, "/" ) Append( superatmo, strtmp ) # go on to construct lower level path name (Mars.Ls.daytime.dust.solar) StringSet( strtmp, "." ) Append( atmostr, strtmp ) Extract( subatmo, solararray, solar ) Append( atmostr, subatmo ) # append lower level path name (Mars.Ls.daytime.dust.solar) to base/upper-level # path Append( superatmo, atmostr ) StringSet( strtmp, "/" ) Append( superatmo, strtmp ) # append base file name (Mars.Ls.daytime.dust.solar.) to path construction Append( superatmo, atmostr ) StringSet( strtmp, "." ) Append( superatmo, strtmp ) # eventually, copy full path-basefilename combi to atmostr, to be consistent # with setups for the other planets, where we used atmostr for the atmo scenario # file location Copy( atmostr, superatmo ) StringSet( infostr, "Atmospheric data taken from: " ) Append( infostr, atmostr ) Print( infostr ) # second, we construct the name for the specific data files one-by-one and read # into corresponding variable Touch( vmr_field_raw ) Touch( abs_species ) WriteXML( output_file_format=tmpformat, in=vmr_field_raw, filename=vmrtmp ) WriteXML( output_file_format=tmpformat, in=abs_species, filename=abstmp ) # (1) z = Altitude Copy( specfilename, atmostr ) StringSet( strtmp, "z.xml" ) Append( specfilename, strtmp ) ReadXML( z_field_raw, specfilename ) # (2) t = Temperature Copy( specfilename, atmostr ) StringSet( strtmp, "t.xml" ) Append( specfilename, strtmp ) ReadXML( t_field_raw, specfilename ) # (3) Ne = electron density Copy( specfilename, atmostr ) ArrayOfStringSet( speciesname, ["free_electrons"] ) Select( casearray, Nearray, Necase ) nelemGet( ncases, casearray ) IndexStepDown( ncases, ncases ) Copy( forloop_agenda, subspeciesloop_agenda ) ForLoop( forloop_agenda, 0, ncases, 1 ) ReadXML( out=abs_species, filename=abstmp ) # (4) base-vmr (species without subscenarios) Copy( specfilename, atmostr ) Select( speciesname, basespeciesarray, basespecies ) abs_speciesAdd( species=speciesname ) WriteXML( output_file_format=tmpformat, in=abs_species, filename=abstmp ) Select( casearray, basespeciesnamesarray, basespecies ) nelemGet( ncases, casearray ) IndexStepDown( ncases, ncases ) Copy( forloop_agenda, speciesloop_agenda ) ForLoop( forloop_agenda, 0, ncases, 1 ) # (5) CH4 Copy( specfilename, atmostr ) ArrayOfStringSet( speciesname, ["CH4"] ) Select( casearray, CH4array, ch4species ) nelemGet( ncases, casearray ) IndexStepDown( ncases, ncases ) Copy( forloop_agenda, subspeciesloop_agenda ) ForLoop( forloop_agenda, 0, ncases, 1 ) ReadXML( out=abs_species, filename=abstmp ) # (6) H2O Copy( specfilename, atmostr ) Select( speciesname, H2Oarray, h2ospecies ) abs_speciesAdd( species=speciesname ) WriteXML( output_file_format=tmpformat, in=abs_species, filename=abstmp ) Select( casearray, H2Onamesarray, h2ospecies ) nelemGet( ncases, casearray ) IndexStepDown( ncases, ncases ) Copy( forloop_agenda, speciesloop_agenda ) ForLoop( forloop_agenda, 0, ncases, 1 ) # now we're ready with the abs_species (and vmr_fields). ReadXML( out=abs_species, filename=abstmp ) ReadXML( out=vmr_field_raw, filename=vmrtmp ) # and we clean up the dummy files (not completely, though. but we write an empty # variable into them.) Delete( strtmp ) Touch( strtmp ) WriteXML( output_file_format=tmpformat, in=strtmp, filename=abstmp ) WriteXML( output_file_format=tmpformat, in=strtmp, filename=vmrtmp ) }