|
25 | 25 | " - 'cams-global-atmospheric-composition-forecasts' \n", |
26 | 26 | " - 'cams-global-reanalysis-eac4-monthly'\n", |
27 | 27 | " sensor_type (str): Sensor type\n", |
| 28 | + " apply_kernels (bool): Apply (True) or not (False) the averaging kernels \n", |
28 | 29 | " \"\"\"\n", |
29 | 30 | "\n", |
30 | 31 | " if ((sensor == 'tropomi' and sensor_type == 'L2' and model == 'cams' and model_full_name == 'cams-global-atmospheric-composition-forecasts') or\n", |
|
90 | 91 | "source": [ |
91 | 92 | "def components_table(sensor, component_nom, sensor_type):\n", |
92 | 93 | "\n", |
93 | | - " \"\"\" Create table with information about the components (molecular weight, full name in different datasets)\n", |
| 94 | + " \"\"\" Create table with information about the atmospheric component (molecular weight and metadata in each dataset)\n", |
94 | 95 | "\n", |
95 | 96 | " Args:\n", |
96 | 97 | " sensor (str): Name of the sensor\n", |
|
275 | 276 | "source": [ |
276 | 277 | "def available_period(sensor, sensor_type, dates, component_nom, *args):\n", |
277 | 278 | "\n", |
278 | | - " \"\"\" Remove dates if the folders where the dataset had to be downloaded are empty (dataset not available)\n", |
| 279 | + " \"\"\" Get available period and remove the folders where the dataset was downloaded as an empty file (not available)\n", |
279 | 280 | " \n", |
280 | 281 | " Args:\n", |
281 | 282 | " sensor (str): Name of the sensor\n", |
|
442 | 443 | "source": [ |
443 | 444 | "def sensor_convert_units(sensor_ds, sensor, component_nom):\n", |
444 | 445 | "\n", |
445 | | - " \"\"\" Convert the units of the sensor dataset for any component from mol/m2 to molecules/cm2\n", |
| 446 | + " \"\"\" Convert the units of the sensor dataset for any component from mol/m2 to molecules/cm2 or DU\n", |
446 | 447 | "\n", |
447 | 448 | " Args:\n", |
448 | 449 | " sensor_ds (xarray): Sensor dataset in xarray format (TROPOMI, IASI or GOME-2)\n", |
|
498 | 499 | " start_date, end_date, component_nom, apply_kernels = False, \n", |
499 | 500 | " CAMS_UID = None, CAMS_key = None):\n", |
500 | 501 | "\n", |
501 | | - " \"\"\" Convert the units of the model dataset for any component from kg/kg or kg/m2 to molecules/cm2\n", |
| 502 | + " \"\"\" Convert the units of the model dataset for any component from kg/kg or kg/m2 to molecules/cm2 or DU\n", |
502 | 503 | "\n", |
503 | 504 | " Args:\n", |
504 | 505 | " model (str): Name of the model\n", |
|
657 | 658 | "source": [ |
658 | 659 | "def subset(ds, bbox, sensor, component_nom, sensor_type, subset_type):\n", |
659 | 660 | "\n", |
660 | | - " \"\"\" Subset any dataset (with latitude and longitude as coordinates) into desired bounding box.\n", |
| 661 | + " \"\"\" Subset any dataset (with latitude and longitude as coordinates) into desired bounding box\n", |
661 | 662 | "\n", |
662 | 663 | " Args:\n", |
663 | 664 | " ds (xarray): Dataset in xarray format\n", |
|
703 | 704 | "source": [ |
704 | 705 | "def prepare_df(match_df_time, sensor, component_nom, time, sensor_type):\n", |
705 | 706 | "\n", |
706 | | - " \"\"\" Prepare dataframe for match\n", |
| 707 | + " \"\"\" Organize dataframe columns for match\n", |
707 | 708 | "\n", |
708 | 709 | " Args:\n", |
709 | 710 | " match_df_time (dataframe): Merge table at specific time \n", |
|
759 | 760 | "source": [ |
760 | 761 | "def generate_match_df(sensor_ds, model_ds, bbox, sensor, component_nom, sensor_type, apply_kernels = False):\n", |
761 | 762 | "\n", |
762 | | - " \"\"\" Intermediate merge table with total column or partial column from both datasets, \n", |
763 | | - " the averaging kernels are applied if possible\n", |
| 763 | + " \"\"\" Intermediate merge table with total column or partial column component data \n", |
| 764 | + " from both datasets, the averaging kernels can be applied\n", |
764 | 765 | "\n", |
765 | 766 | " Args:\n", |
766 | 767 | " sensor_ds (xarray): Sensor dataset in xarray format (TROPOMI, IASI or GOME-2)\n", |
|
1057 | 1058 | "def colorbar_range(range_type, data_array, diff_array, max_all, min_all, max_all_diff, min_all_diff,\n", |
1058 | 1059 | " vmin_manual, vmax_manual, vmin_manual_diff, vmax_manual_diff):\n", |
1059 | 1060 | "\n", |
1060 | | - " \"\"\" Define colorbar range\n", |
| 1061 | + " \"\"\" Define colorbar range boundaries (original, equal, manual or centered)\n", |
1061 | 1062 | "\n", |
1062 | 1063 | " Args:\n", |
1063 | 1064 | " range_type (str): Range type for colorbar:\n", |
|
1535 | 1536 | "source": [ |
1536 | 1537 | "def define_absolute_limits(vmin_manual, vmax_manual, model_df, sensor_df, diff_df):\n", |
1537 | 1538 | "\n", |
1538 | | - " \"\"\" Define absolute minimum and maximum within model and sensor datasets.\n", |
1539 | | - " Get manual minimum and maximum or calculate it\n", |
| 1539 | + " \"\"\" Define absolute minimum and maximum within model and sensor datasets\n", |
1540 | 1540 | "\n", |
1541 | 1541 | " Args:\n", |
1542 | 1542 | " vmin_manual (float): Input vmin by user\n", |
|
1595 | 1595 | " bbox_list = None, coords_list = None, regions_names = None):\n", |
1596 | 1596 | "\n", |
1597 | 1597 | " \"\"\" Plot model and sensor datasets in the study area for the selected dates, \n", |
1598 | | - " along with a plot of the differences\n", |
| 1598 | + " along with a plot of the differences (aggregated, animated, individual or seasonal)\n", |
1599 | 1599 | "\n", |
1600 | 1600 | " Args:\n", |
1601 | 1601 | " model (str): Name of the model\n", |
|
1793 | 1793 | " width_lon, height_lat,\n", |
1794 | 1794 | " vmin_manual = None, vmax_manual = None):\n", |
1795 | 1795 | "\n", |
1796 | | - " \"\"\" Plot model total columns from the original dataset and the calculated one \n", |
1797 | | - " in the study area for the selected dates\n", |
| 1796 | + " \"\"\" Plot model total columns from the original dataset and model total columns \n", |
| 1797 | + " after applying the averaging kernels in the study area for the selected dates\n", |
1798 | 1798 | "\n", |
1799 | 1799 | " Args:\n", |
1800 | 1800 | " model (str): Name of the model\n", |
|
1921 | 1921 | "metadata": {}, |
1922 | 1922 | "outputs": [], |
1923 | 1923 | "source": [ |
1924 | | - "def get_google_api():\n", |
| 1924 | + "def get_Google_API():\n", |
1925 | 1925 | "\n", |
1926 | 1926 | " \"\"\" Get Google API key for reverse geocoding (get country given the coordinates)\n", |
1927 | 1927 | " \n", |
|
1953 | 1953 | "source": [ |
1954 | 1954 | "def get_season(day):\n", |
1955 | 1955 | "\n", |
1956 | | - " \"\"\" Get season given the day\n", |
| 1956 | + " \"\"\" Get season given a date\n", |
1957 | 1957 | "\n", |
1958 | 1958 | " Args:\n", |
1959 | 1959 | " day (datetime): Date\n", |
|
1985 | 1985 | "source": [ |
1986 | 1986 | "def linear_regression(axs, X, Y, component_nom):\n", |
1987 | 1987 | "\n", |
1988 | | - " \"\"\" Fit a linear equation to scatter plot between X and Y and print results\n", |
| 1988 | + " \"\"\" Fit a linear equation to scatter plot between X and Y and get R2, RMSE and MSE\n", |
1989 | 1989 | "\n", |
1990 | 1990 | " Args:\n", |
1991 | 1991 | " axs (axes): Plot axes\n", |
|
2039 | 2039 | "source": [ |
2040 | 2040 | "def stats_plots_general_settings(axs, component_nom, units, lim_min, lim_max):\n", |
2041 | 2041 | "\n", |
2042 | | - " \"\"\" Set common settings for scatter plots\n", |
| 2042 | + " \"\"\" Set common settings for scatter plot and histograms\n", |
2043 | 2043 | "\n", |
2044 | 2044 | " Args:\n", |
2045 | 2045 | " axs (axes): Plot axes\n", |
|
2226 | 2226 | " elif extent_definition == 'country':\n", |
2227 | 2227 | "\n", |
2228 | 2228 | " # Read Google API key for reverse geocoding (get country by coordinates)\n", |
2229 | | - " google_api_key = get_google_api()\n", |
| 2229 | + " google_api_key = get_Google_API()\n", |
2230 | 2230 | "\n", |
2231 | 2231 | " # Reverse geocoding\n", |
2232 | 2232 | " merge_df['country'] = merge_df.apply(lambda row: geocoder.google([row['latitude'], row['longitude']], \n", |
|
2440 | 2440 | "def timeseries(merge_df, component_nom, sensor, sensor_type, model, plot_dates, units, \n", |
2441 | 2441 | " ymin, ymax, xticks, regions_names, coords_list):\n", |
2442 | 2442 | "\n", |
2443 | | - " \"\"\" Get component data for the closest coordinates to the list of search coordinates and plot them along time\n", |
| 2443 | + " \"\"\" Get component data for the closest coordinates to a list of search coordinates and create a timeseries plot\n", |
2444 | 2444 | "\n", |
2445 | 2445 | " Args:\n", |
2446 | 2446 | " merge_df (dataframe): Merge table with datasets total columns and difference\n", |
|
2646 | 2646 | "def trends(merge_df, component_nom, sensor, model, units, ymin, ymax, \n", |
2647 | 2647 | " plot_dates, regions_names, bbox_list, sensor_break_date, model_break_date):\n", |
2648 | 2648 | "\n", |
2649 | | - " \"\"\" Get trends by region, defined by coordinates. These trends are generated following linear and sinusoidal models.\n", |
| 2649 | + " \"\"\" Get trends (linear + sinusoidal model) by region, defined by coordinates\n", |
2650 | 2650 | "\n", |
2651 | 2651 | " Args:\n", |
2652 | 2652 | " merge_df (dataframe): Merge table with datasets total columns and difference\n", |
|
3067 | 3067 | " width_lon, height_lat, \n", |
3068 | 3068 | " bbox_list = None, coords_list = None, regions_names = None):\n", |
3069 | 3069 | "\n", |
3070 | | - " \"\"\" Get trends at whole plot bounding box. These trends are generated following a linear model.\n", |
3071 | | - " This function is only available for trends without breaks or with a common break \n", |
3072 | | - " at the same day for both the model and sensor datasets.\n", |
| 3070 | + " \"\"\" Plot trends (linear) in the study area for selected dates. This function is only available for trends \n", |
| 3071 | + " without breaks or with a common break at the same day for both the model and sensor datasets.\n", |
3073 | 3072 | "\n", |
3074 | 3073 | " Args:\n", |
3075 | 3074 | " merge_df (dataframe): Merge table with datasets total columns and difference\n", |
|
0 commit comments