Example #1
0
def option1():
    '''
    Option 1 is the simplest: a single point and time
    '''
    while 1:   
        print('Enter value for format of latitudes and longitudes: ')
        print('1 - in degrees & minutes')
        print('2 - in decimal degrees')
        idm = input('->').rstrip()
        idm = iut.check_int(idm)       
        if idm < 1 or idm > 2: continue
        else:
            break

#    if iopt == 1:  # Start with a simple example, values at one location and time

    while 1:
        print('Enter value for coordinate system:')
        print('1 - geodetic (shape of Earth using the WGS-84 ellipsoid)')
        print('2 - geocentric (shape of Earth is approximated by a sphere)')
        itype = input('->').rstrip()
        itype = iut.check_int(itype)
        if itype < 1 or itype > 2: continue
        else:
            break
        
    if idm == 1:
        print( 'Enter latitude & longitude in degrees & minutes')
        print( '(if either latitude or longitude is between -1')
        print( 'and 0 degrees, enter the minutes as negative).')
        print( 'Enter integers for degrees, floats for the minutes if needed' )
        LTD,LTM,LND,LNM = input('-> ').rstrip().split(' ')  
        latd = iut.check_int(LTD)
        latm = iut.check_float(LTM)
        lond = iut.check_int(LND)
        lonm = iut.check_float(LNM)
        
        lat, lon = iut.check_lat_lon_bounds(latd,latm,lond,lonm)
        colat = 90-lat
    else:
        print( 'Enter latitude & longitude in decimal degrees')
        LTD,LND = input('-> ').rstrip().split(' ') 
        latd = iut.check_float(LTD)
        lond = iut.check_float(LND)
        
        lat, lon = iut.check_lat_lon_bounds(latd,0,lond,0)
        colat = 90-lat
        
    while 1:
        if itype==1:
            alt = input( 'Enter altitude in km: ').rstrip()
            alt = iut.check_float(alt)
            alt, colat, sd, cd = iut.gg_to_geo(alt, colat)
        else:
            alt = input( 'Enter radial distance in km (>3485 km): ').rstrip()
            alt = iut.check_float(alt)
            sd = 0; cd = 0
        
        if (itype == 2) and (alt < 3485):
            print('Alt must be greater then CMB radius (3485 km)').rstrip()
            continue
        else:
            break
        
    while 1: 
        date = input('Enter decimal date in years 1900-2025: ').rstrip()
        date = iut.check_float(date)
        if date < 1900 or date > 2030: continue
        else:
            break   

    return date, alt, lat, colat, lon, itype, sd, cd
Example #2
0
def option2():
    '''
    Option 2 is the single point at multiple integer years (2015, 2016, 2017 ...)
    and at the same altitude
    '''
    while 1:   
        print('Enter value for format of latitudes and longitudes: ')
        print('1 - in degrees & minutes')
        print('2 - in decimal degrees')
        idm = input('->').rstrip()
        idm = iut.check_int(idm)       
        if idm < 1 or idm > 2: continue
        else:
            break

#    if iopt == 1:  # Start with a simple example, values at one location and time

    while 1:
        print('Enter value for coordinate system:')
        print('1 - geodetic (shape of Earth using the WGS-84 ellipsoid)')
        print('2 - geocentric (shape of Earth is approximated by a sphere)')
        itype = input('->').rstrip()
        itype = iut.check_int(itype)
        if itype < 1 or itype > 2: continue
        else:
            break
        
    if idm == 1:
        print( 'Enter latitude & longitude in degrees & minutes')
        print( '(if either latitude or longitude is between -1')
        print( 'and 0 degrees, enter the minutes as negative).')
        print( 'Enter 4 integers' )
        LTD,LTM,LND,LNM = input('-> ').rstrip().split(' ')  
        latd = iut.check_int(LTD)
        latm = iut.check_float(LTM)
        lond = iut.check_int(LND)
        lonm = iut.check_float(LNM)
        
        lat, lon = iut.check_lat_lon_bounds(latd,latm,lond,lonm)
        colat = 90-lat
    else:
        print( 'Enter latitude & longitude in decimal degrees')
        LTD,LND = input('-> ').rstrip().split(' ') 
        latd = iut.check_float(LTD)
        lond = iut.check_float(LND)
        
        lat, lon = iut.check_lat_lon_bounds(latd,0,lond,0)
        colat = 90-lat
        
    while 1:
        if itype==1:
            alt = input( 'Enter altitude in km: ').rstrip()
            alt = iut.check_float(alt)
            alt, colat, sd, cd = iut.gg_to_geo(alt, colat)
        else:
            alt = input( 'Enter radial distance in km (>3485 km): ').rstrip()
            alt = iut.check_float(alt)
            sd = 0; cd = 0
        
        if ((itype == 2) and (alt < 3485)) or ((itype == 1) and (alt < -3300)) :
            print('Alt must be greater then CMB radius (3485 km)')
            continue
        else:
            break
        
    while 1: 
        dates = input('Enter start decimal date in years 1900-2025: ').rstrip()
        dates = iut.check_float(dates)
        if dates < 1900 or dates > 2030: continue
        else:
            break
    while 1:
        datee = input('Enter end decimal date in years 1900-2025: ').rstrip()
        datee = iut.check_float(datee)
        if datee < 1900 or datee > 2030: 
            continue
        elif datee < dates: continue
        else:
            break   

    date = np.arange(dates,datee+1)
    alt = np.ones(len(date),) * alt
    lat = np.ones(len(date),) * lat
    colat = np.ones(len(date),) * colat
    lon = np.ones(len(date),) * lon
    sd = np.ones(len(date),) * sd
    cd = np.ones(len(date),) * cd    
    
    return date, alt, lat, colat, lon, itype, sd, cd
Example #3
0
def option3():
    '''
    Option 3 is a grid of points at a single time and altitude.
    Only decimal degrees are accepted. Increments are checked to be sensible.
    '''

    while 1:
        print('Enter value for coordinate system:')
        print('1 - geodetic (shape of Earth using the WGS-84 ellipsoid)')
        print('2 - geocentric (shape of Earth is approximated by a sphere)')
        itype = input('->')
        itype = iut.check_int(itype)
        if itype < 1 or itype > 2: continue
        else:
            break
        
    while 1:
        print( 'Enter starting latitude, increment/decrement and '
              'final latitude in decimal degrees')
        LTS, LTI, LTE = input('-> ').rstrip().split(' ') 
        lats = iut.check_float(LTS)
        lati = iut.check_float(LTI)
        late = iut.check_float(LTE)
        
        if lats < -90 or lats > 90 or late < -90 or late > 90: 
            continue
            
        if (abs(lati) > (abs(lats - late))): 
            print('Increment or decrement are larger than the gap between the ' 
                  'start and end points') 
            continue
        else:
                break
              
        
    while 1:
        print( 'Enter starting longitude, increment/decrement and'
              ' final longitude in decimal degrees')
        LNS, LNI, LNE = input('-> ').rstrip().split(' ') 
        lons = iut.check_float(LNS)
        loni = iut.check_float(LNI)
        lone = iut.check_float(LNE)
        
        if lons < -180 or lons > 360 or lone < -180 or lone > 360: continue
        if abs(loni) > abs((lons) - (lone)):
            print('Increment or decrement are larger than the gap between the '
                  'start and end points') 
            continue
        else:
            break
     
        
    while 1:
        if itype==1:
            alt = input( 'Enter altitude in km: ').rstrip()
            alt = iut.check_float(alt)
        else:
            alt = input( 'Enter radial distance in km (>3485 km): ').rstrip()
            alt = iut.check_float(alt)
            sd = 0; cd = 0
        
        if (itype == 2) and (alt < 3485):
            print('Alt must be greater then CMB radius (3485 km)').rstrip()
            continue
        else:
            break
        
    while 1: 
        date = input('Enter decimal date in years 1900-2025: ').rstrip()
        date = iut.check_float(date)
        if date < 1900 or date > 2030: continue
        else:
            break

        

    # Create a meshgrid to fill in the colat/lons
    colat, lon = np.meshgrid(90-np.arange(lats,late,lati),
                             np.arange(lons,lone,loni) )
    # Arrange into a long vector for synth grid
    colat = colat.flatten()
    lon = lon.flatten()
    lat = 90-colat
    
    # Convert geodetic latitude to geocentric, if required
    if itype==1:
         alt, colat, sd, cd = iut.gg_to_geo(np.ones(len(colat),)*alt, colat[:])
    
    date = np.ones(len(lon),) * date
     
    return date, alt, lat, colat, lon, itype, sd, cd