CERES Ice Comparisons - sorensonb/Arctic_codes GitHub Wiki

CERES/NSIDC Comparisons

These codes are for comparing the CERES SSF_1Deg gridded data with the NSIDC sea ice concentration data. Directory:

CERES SSF_1Deg Data Codes

gridCERESLib.py

  • Custom library code containing functions for analyzing CERES SSF_1Deg data.
  • Functions:
    • readgridCERES
      • SYNTAX: readgridCERES(start_date,end_date,param,minlat=70.5,season='all')
        • start_date: beginning of the desired time window (example: 200101)
        • end_date: ending of the desired time window (example: 201812)
        • param : the desired parameter from the data file (examples, toa_alb_clr_mon,toa_sw_all_mon,etc.)
        • minlat: minimum latitude to read in data for. For example, if the minimum latitude is 70.5, data will be read in for all longitudes for all latitudes between 70.5 and 89.5
        • season: desired season. Options are 'spring','summer','autumn','winter','all'.
      • Read in CERES SSF_1Deg data. The data are located on the 'npp' server at the location '/home/shared/CERES/SSF_1Deg/Terra/'.
    • calc_avgCERES
      • stuff
    • calc_CERES_trend
      • more stuff

Scripts

  • auto_grid_runner.py
    • A script that automates the functions in the gridCERESLib library.

NSIDC Ice Data Codes

IceLib.py

  • Custom module file holding functions used to read and plot NSIDC ice concentration data.
  • Functions
    • plot_data
      • SYNTAX: plot_data(ice_dict,index)
        • ice_dict: The dictionary containing the ice concentration data that comes out of read_ice
        • index: A time index used to plot a certain month of data in the dictionary
      • Plots the ice concentration data for one month of data in the ice_data dictionary
    • trend_calc
      • SYNTAX: trend,pcnt_change = trend_calc(ice_dict,x_ind,y_ind,thielsen=False)
        • trend: the trend at the current index
        • pcnt_change: percent change with respect to the average ice concentration value over the time period at the grid point
        • ice_dict: The dictionary containing the ice concentration data that comes out of read_ice
        • x_ind: Value between 0 and 448
        • y_ind: Value between 0 and 304
        • thielsen: If 'True', the Thiel-Sen method is used to calculate the slope, and the slope is used to find the trend. If 'False', linear regression is used to find the slope.
      • Calculate the ice concentration trend in the ice_dict dictionary at the x_ind and y_ind coordinates.
      • NOTE: These data are not the 1x1 degree gridded data output from grid_data. These data are the raw concentrations, in the 25x25 km grid, that come out of the read_ice function
      • The trend and the percent change are returned.
    • read_ice
      • SYNTAX: ice_data = read_ice(season)
        • season: 'spring','summer','autumn','winter','all'
      • Read the monthly NSIDC sea ice concentration data from the raw binary files into a dictionary.
      • The dictionary is formatted as such:
        • ice_data['data']: A 3D array containing all ice concentration data for all months between January 2001 and December 2018. The dimensions of the array are time, x, and y.
        • ice_data['lat']: the latitudes of each raw ice concentration ob in the 'data' key.
        • ice_data['lon']: the longitudes of each raw ice concentration ob in the 'data' key.
        • ice_data['trends']: all the trends at each 25x25 km gridpoint only over ice and water, not on land. In this dictionary key, any trends over land are set to missing.
        • ice_data['land_trends']: all the trends over land, not on ice or water. In this dictionary key, any trends not over land are set to missing.
        • ice_data['titles']: all the file names corresponding to each data month file.
        • ice_data['season_adder']: a title adder that contains a space followed by the season. If 'all' is selected, season_adder is set to ''
        • ice_data['file_adder']: the same as season_adder, but the space at the beginning is replaced with an '_'. Used for updating the image file names.
    • ice_trendCalc
      • SYNTAX: ice_data = ice_trendCalc(ice_data,thielSen=False)
        • ice_data: ice data dictionary, generated as output from read_ice
        • thielSen: If 'True', the Thiel-Sen slope method is used to calculate the slope, which is used to find the trend. If 'False', linear regression is used.
      • Calculate the trends in the 25x25 km ice data dictionary (generated by read_ice)
    • grid_data
      • SYNTAX: ice_data = grid_data(ice_data)
        • ice_data: ice data dictionary, generated as output from read_ice. This dictionary must have been run through ice_trendCalc to calculate all the trends before this.
      • Averages the trends of the 25x25 km grid into a 1x1 degree grid.
    • plot_grid_data
      • SYNTAX: plot_grid_data(ice_data,adjusted=False,save=False)
        • ice_data: ice data dictionary, generated as output from read_ice. This dictionary must have been run through grid_ice to average all the trends into a 1x1 degree grid before this.
        • adjusted: If 'True', the resulting figure is zoomed, rotated, and the continents are colored in to match how the normal ice figures are generated from IceLib. If 'False', the plot is neither zoomed, rotated, nor colored like the ice plots.
        • save: If 'True', the figures is saved.
      • Makes a plot of the 1x1 degree gridded trends.

Scripts

  • ice_trend.py
    • NOTE: The functions in ice_trend were moved to IceLib.py
    • Calculate trends in the ice concentration data.
    • Capable of splitting into seasons (spring, summer, autumn, winter)
    • Also capable of using Thiel-Sen trends to calculate the trends over the time period.
  • read_ice_bin.py
    • read_ice_bin.py is a script written to test how to read NSIDC ice concentration data and plot the data with pcolormesh.
  • automate_Ice_download.py
    • A script that automatically downloads the NSIDC ice concentration data.

Comparison Codes

Scripts

  • comparelib.py
    • Module file that contains a function used to generate the scatter plot
    • Functions:
      • correlation
        • SYNTAX: corr = correlation(x,y)
          • x and y are arrays (of the same length)
        • Calculate correlation between two arrays
      • plot_fourscatter
        • SYNTAX: plot_fourscatter(ice_data,CERES_lw_dict,CERES_sw_dict,CERES_alb_dict,CERES_net_dict,inseason)
          • ice_data: ice data dictionary containing 1x1 degree gridded ice trends from the grid_data function
          • CERES_lw_dict: CERES data dictionary containing LWF trends. This dictionary is outputted from calc_CERES_trend
          • CERES_sw_dict: CERES data dictionary containing SWF trends. This dictionary is outputted from calc_CERES_trend
          • CERES_alb_dict: CERES data dictionary containing albedo trends. This dictionary is outputted from calc_CERES_trend
          • CERES_net_dict: CERES data dictionary containing net flux trends. This dictionary is outputted from calc_CERES_trend
          • inseason: string containing the season of the ice and CERES data ('spring','summer','autumn','winter')
        • Generate the four-panel scatter plots of the ice trends and CERES trends
  • compare_ceres_ice.py
    • SYNTAX: ./compare_ceres_ice.py season
      • season: 'spring','summer','autumn','winter','all'
    • Calculate trends in the CERES and NSIDC data and generate scatter plot comparison figures. Functions from IceLib and gridCERESLib are imported and used in this script. To allow this script to access the other module files, two lines are added in the middle of the import statements to add the path to each module file to the Python path. When running this script, ensure that these two paths point to the locations of the IceLib.py and gridCERESLib.py files.

Return to top

Return Home