################################################################################ # # # 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 Jupiter as specified by the user. For user specification # # use, e.g., DemoJupiterAtmo1D.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_jupiter.arts (hence, atmo_jupiter.arts needs # # to be included before the file at hand). # # # # This file expects the following input parameters: # # atmo (Index) 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/high). # # nh3species (ArrayOfIndex) NH3 setup selected (off/low/high). # # ch4species (ArrayOfIndex) CH4 setup (optional isotopologues). # # h2species (ArrayOfIndex) H2 setup (optional isotopologues). # # Necase (ArrayOfIndex) Electron density setup selected # # (off/low/medium/high). # # # # Files to be included before this file: # # includesjupiter/atmo_jupiter.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_jupiter.xml" ) StringSet( abstmp, "abstmp_jupiter.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 setup # --- # first, create the casename string down to the common filename part in the # scenario folder. Data is located in: # Jupiter.atmo/ Copy( atmostr, atmobase ) Extract( subatmo, atmoarray, atmo ) Append( atmostr, subatmo ) StringSet( strtmp, "/" ) Append( atmostr, strtmp ) Append( atmostr, subatmo ) StringSet( strtmp, "." ) Append( atmostr, strtmp ) 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.gz" ) Append( specfilename, strtmp ) ReadXML( z_field_raw, specfilename ) # (2) t = Temperature Copy( specfilename, atmostr ) StringSet( strtmp, "t.xml.gz" ) 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 ) # third, recreate the casename string down to the common filename part in the # scenario folder for species taken from mean in any case. Copy( atmostr, atmobase ) Extract( subatmo, atmoarray, 0 ) Append( atmostr, subatmo ) StringSet( strtmp, "/" ) Append( atmostr, strtmp ) Append( atmostr, subatmo ) StringSet( strtmp, "." ) Append( atmostr, strtmp ) # forth, do the one-by-one construction and reading of specific data for species from mean # (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) H2O Copy( specfilename, atmostr ) ArrayOfStringSet( speciesname, ["H2O"] ) Select( casearray, H2Oarray, h2ospecies ) nelemGet( ncases, casearray ) IndexStepDown( ncases, ncases ) Copy( forloop_agenda, subspeciesloop_agenda ) ForLoop( forloop_agenda, 0, ncases, 1 ) # (6) NH3 Copy( specfilename, atmostr ) ArrayOfStringSet( speciesname, ["NH3"] ) Select( casearray, NH3array, nh3species ) nelemGet( ncases, casearray ) IndexStepDown( ncases, ncases ) Copy( forloop_agenda, subspeciesloop_agenda ) ForLoop( forloop_agenda, 0, ncases, 1 ) ReadXML( out=abs_species, filename=abstmp ) # (7) CH4 Copy( specfilename, atmostr ) Select( speciesname, CH4array, ch4species ) abs_speciesAdd( species=speciesname ) WriteXML( output_file_format=tmpformat, in=abs_species, filename=abstmp ) Select( casearray, CH4namesarray, ch4species ) nelemGet( ncases, casearray ) IndexStepDown( ncases, ncases ) Copy( forloop_agenda, speciesloop_agenda ) ForLoop( forloop_agenda, 0, ncases, 1 ) # (8) H2 Copy( specfilename, atmostr ) Select( speciesname, H2array, h2species ) abs_speciesAdd( species=speciesname ) WriteXML( output_file_format=tmpformat, in=abs_species, filename=abstmp ) Select( casearray, H2namesarray, h2species ) 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 ) }