Skip to content

Instantly share code, notes, and snippets.

@MathewBiddle
Created August 11, 2023 17:17
Show Gist options
  • Save MathewBiddle/9f14ba37aa9dd86d63b0807bda6a292d to your computer and use it in GitHub Desktop.
Save MathewBiddle/9f14ba37aa9dd86d63b0807bda6a292d to your computer and use it in GitHub Desktop.
dataTypes_available_on_ERDDAP.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyMpBl+LXtpvt4QJGkw1r7NI",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/MathewBiddle/9f14ba37aa9dd86d63b0807bda6a292d/datatypes_available_on_erddap.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"source": [
"!pip install erddapy"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "RTEcRpBTHd9F",
"outputId": "cce52b6b-bca4-47e4-d9bc-cee834106fb8"
},
"execution_count": 9,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Collecting erddapy\n",
" Downloading erddapy-2.2.0-py3-none-any.whl (22 kB)\n",
"Collecting httpx (from erddapy)\n",
" Downloading httpx-0.24.1-py3-none-any.whl (75 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.4/75.4 kB\u001b[0m \u001b[31m2.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: pandas<3,>=0.25.2 in /usr/local/lib/python3.10/dist-packages (from erddapy) (1.5.3)\n",
"Requirement already satisfied: pytz in /usr/local/lib/python3.10/dist-packages (from erddapy) (2022.7.1)\n",
"Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3,>=0.25.2->erddapy) (2.8.2)\n",
"Requirement already satisfied: numpy>=1.21.0 in /usr/local/lib/python3.10/dist-packages (from pandas<3,>=0.25.2->erddapy) (1.23.5)\n",
"Requirement already satisfied: certifi in /usr/local/lib/python3.10/dist-packages (from httpx->erddapy) (2023.7.22)\n",
"Collecting httpcore<0.18.0,>=0.15.0 (from httpx->erddapy)\n",
" Downloading httpcore-0.17.3-py3-none-any.whl (74 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m74.5/74.5 kB\u001b[0m \u001b[31m7.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: idna in /usr/local/lib/python3.10/dist-packages (from httpx->erddapy) (3.4)\n",
"Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from httpx->erddapy) (1.3.0)\n",
"Collecting h11<0.15,>=0.13 (from httpcore<0.18.0,>=0.15.0->httpx->erddapy)\n",
" Downloading h11-0.14.0-py3-none-any.whl (58 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m5.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hRequirement already satisfied: anyio<5.0,>=3.0 in /usr/local/lib/python3.10/dist-packages (from httpcore<0.18.0,>=0.15.0->httpx->erddapy) (3.7.1)\n",
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.1->pandas<3,>=0.25.2->erddapy) (1.16.0)\n",
"Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from anyio<5.0,>=3.0->httpcore<0.18.0,>=0.15.0->httpx->erddapy) (1.1.2)\n",
"Installing collected packages: h11, httpcore, httpx, erddapy\n",
"Successfully installed erddapy-2.2.0 h11-0.14.0 httpcore-0.17.3 httpx-0.24.1\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Look at asset inventory for long_name attributes."
],
"metadata": {
"id": "XLfgEQO6kCbU"
}
},
{
"cell_type": "code",
"source": [
"from erddapy import ERDDAP\n",
"import pandas as pd\n",
"\n",
"server = 'https://erddap.ioos.us/erddap/'\n",
"\n",
"e = ERDDAP(\n",
" server=server,\n",
" protocol=\"tabledap\",\n",
" response=\"csv\"\n",
")\n",
"\n",
"dataset_id = 'processed_asset_inventory'\n",
"\n",
"info_url = e.get_info_url(dataset_id=dataset_id, response=\"csv\")\n",
"\n",
"df = pd.read_csv(info_url)\n",
"\n",
"print(df.loc[df['Attribute Name']=='long_name','Value'].to_csv(index=False))"
],
"metadata": {
"id": "KEXnYfjPyFO2",
"colab": {
"base_uri": "https://localhost:8080/"
},
"outputId": "ec23442c-a76c-449a-d8d7-598650d9fe88"
},
"execution_count": 32,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Value\n",
"Year of the inventory in YYYY format\n",
"RA\n",
"Latitude\n",
"Longitude\n",
"Station Long Name\n",
"Platform\n",
"Operational\n",
"Station Deployment\n",
"RA Funded\n",
"Water Temp\n",
"Salinity\n",
"Wtr Press\n",
"Dew Pt\n",
"Rel Hum\n",
"Air Temp\n",
"Winds\n",
"Air Press\n",
"Precipitation\n",
"Solar Radn\n",
"Visibility\n",
"Water Level\n",
"Waves\n",
"Currents\n",
"Turbidity\n",
"DO\n",
"P CO2 Water\n",
"P CO2 Air\n",
"TCO2\n",
"pH\n",
"Omg Arag St\n",
"CHL\n",
"Nitrate\n",
"Chromophoric Dissolved Organic Material\n",
"Alkalinity\n",
"Acoustics\n",
"Raw Vars\n",
"Coordinate reference system information\n",
"\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"# Look at IOOS Sensor Map and print all unique `standard_name` attributes that don't contain 'flag'."
],
"metadata": {
"id": "2karHbnzk1N_"
}
},
{
"cell_type": "code",
"source": [
"from erddapy import ERDDAP\n",
"\n",
"server = 'https://erddap.sensors.ioos.us/erddap/'\n",
"\n",
"e = ERDDAP(\n",
" server=server,\n",
" protocol=\"tabledap\",\n",
" response=\"csv\"\n",
")\n",
"\n",
"url = e.get_categorize_url(categorize_by=\"standard_name\", response=\"csv\")\n",
"\n",
"df_long_name = pd.read_csv(url)\n",
"\n",
"df_long_name.drop_duplicates(inplace=True)\n",
"\n",
"long_names = df_long_name.loc[~df_long_name['Category'].str.contains('flag'),'Category']\n",
"\n",
"print(long_names.to_csv(index=False))"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "pG2hoYEEJzlC",
"outputId": "b828ecd7-f5a8-4d49-bb44-201e04727a95"
},
"execution_count": 31,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Category\n",
"_null\n",
"air_pressure\n",
"air_pressure_at_mean_sea_level\n",
"air_temperature\n",
"altitude\n",
"ammonium\n",
"atmosphere_net_rate_of_absorption_of_energy\n",
"battery_voltage\n",
"bicarbonate_ion_hco3-\n",
"biochemicaloxygendemand\n",
"bioluminescence\n",
"blue_green_algae\n",
"carbon_dioxide_fugacity_difference_between_air_and_sea_water\n",
"carbonate_ion_co3--\n",
"cdom\n",
"concentration_of_colored_dissolved_organic_matter_in_sea_water_expressed_as_equivalent_mass_fraction_of_quinine_sulfate_dihydrate\n",
"condsrf\n",
"depth\n",
"depth_to_sea_floor\n",
"depth_to_water_level\n",
"dew_point_temperature\n",
"direction_of_sea_ice_velocity\n",
"dissolved_carbon_dioxide_co2\n",
"dissolved_inorganic_carbon\n",
"dissolved_organic_carbon\n",
"downwelling_photosynthetic_photon_flux_in_sea_water\n",
"eastward_sea_ice_velocity\n",
"eastward_sea_water_velocity\n",
"eastward_wind\n",
"fluorescence\n",
"fluorescent_dissolved_organic_matter\n",
"fractional_saturation_of_oxygen_in_sea_water\n",
"freezing_point\n",
"fuel_moisture\n",
"fuel_temperature\n",
"fugacity_of_carbon_dioxide_in_air\n",
"fugacity_of_carbon_dioxide_in_sea_water\n",
"heat_index\n",
"height\n",
"latitude\n",
"longitude\n",
"longwave_radiation\n",
"lwe_precipitation_rate\n",
"lwe_thickness_of_precipitation_amount\n",
"lwe_water_evaporation_rate\n",
"mass_concentration_dissolved_inorganic_carbon\n",
"mass_concentration_of_chlorophyll_a_in_sea_water\n",
"mass_concentration_of_chlorophyll_in_sea_water\n",
"mass_concentration_of_oxygen_in_sea_water\n",
"mass_concentration_of_phycoerythrin_expressed_as_chlorophyll_in_sea_water\n",
"mass_concentration_of_sediment_in_sea_water\n",
"mass_concentration_particulate_nitrogen\n",
"mass_concentration_particulate_organic_carbon\n",
"mass_concentration_total_dissolved_nitrogen\n",
"mass_fraction_of_chlorophyll_a_in_sea_water\n",
"mean_wave_to_direction\n",
"mole_concentration_dissolved_silica\n",
"mole_concentration_of_dissolved_molecular_oxygen_in_sea_water\n",
"mole_concentration_of_nitrate_in_sea_water\n",
"mole_fraction_of_carbon_dioxide_in_air_in_dry_gas\n",
"mole_fraction_of_carbon_dioxide_in_air_in_wet_gas\n",
"mole_fraction_of_carbon_dioxide_in_sea_water_in_dry_gas\n",
"mole_fraction_of_carbon_dioxide_in_sea_water_in_wet_gas\n",
"mole_fraction_of_water_vapor_in_air\n",
"nitrate\n",
"nitrite\n",
"nitrite_plus_nitrate\n",
"north_sea_water_velocity\n",
"northward_sea_ice_velocity\n",
"northward_sea_water_velocity\n",
"northward_wind\n",
"omega_aragonite\n",
"panel_temperature\n",
"pco2\n",
"pco2_in_air\n",
"pco2_in_sea_water\n",
"percent_oxygen_ratio_between_air_and_sea_water\n",
"phaeophytin\n",
"phosphate\n",
"phycocyanin\n",
"phycoerythrin\n",
"ppm_of_carbon_dioxide_in_air\n",
"ppm_of_carbon_dioxide_in_air_in_dry_gas\n",
"ppm_of_carbon_dioxide_in_sea_water_in_wet_gas\n",
"relative_humidity\n",
"river_discharge\n",
"sea_floor_depth_below_sea_surface\n",
"sea_ice_speed\n",
"sea_nettle_probability\n",
"sea_surface_height\n",
"sea_surface_height_above_sea_level\n",
"sea_surface_height_amplitude_due_to_geocentric_ocean_tide\n",
"sea_surface_swell_wave_period\n",
"sea_surface_swell_wave_significant_height\n",
"sea_surface_swell_wave_to_direction\n",
"sea_surface_temperature\n",
"sea_surface_wave_directional_spread\n",
"sea_surface_wave_directional_spread_at_variance_spectral_density_maximum\n",
"sea_surface_wave_from_direction\n",
"sea_surface_wave_from_direction_at_variance_spectral_density_maximum\n",
"sea_surface_wave_maximum_height\n",
"sea_surface_wave_maximum_period\n",
"sea_surface_wave_mean_height\n",
"sea_surface_wave_mean_height_of_highest_tenth\n",
"sea_surface_wave_mean_period\n",
"sea_surface_wave_period_at_variance_spectral_density_maximum\n",
"sea_surface_wave_significant_height\n",
"sea_surface_wave_to_direction\n",
"sea_surface_wind_wave_period\n",
"sea_surface_wind_wave_significant_height\n",
"sea_surface_wind_wave_to_direction\n",
"sea_water_density\n",
"sea_water_electrical_conductivity\n",
"sea_water_ph_reported_on_total_scale\n",
"sea_water_practical_salinity\n",
"sea_water_pressure\n",
"sea_water_pressure_due_to_sea_water\n",
"sea_water_sigma_t\n",
"sea_water_sigma_theta\n",
"sea_water_speed\n",
"sea_water_temperature\n",
"sea_water_turbidity\n",
"sea_water_velocity_to_direction\n",
"secchi_depth_of_sea_water\n",
"short_wave_radiation\n",
"shortwave_radiation\n",
"silicate\n",
"snow_water_equivalent\n",
"soil_moisture_percent\n",
"soil_salinity\n",
"soil_temperature\n",
"solar_irradiance\n",
"specific_conductance\n",
"speed_of_sound_in_sea_water\n",
"surface_albedo\n",
"surface_downwelling_longwave_flux_in_air\n",
"surface_downwelling_photosynthetic_photon_flux_in_air\n",
"surface_downwelling_photosynthetic_radiative_flux_in_air\n",
"surface_downwelling_shortwave_flux_in_air\n",
"surface_snow_thickness\n",
"surface_temperature\n",
"thickness_of_rainfall_amount\n",
"thickness_of_snowfall_amount\n",
"time\n",
"toa_incoming_shortwave_flux\n",
"toa_outgoing_shortwave_flux\n",
"total_alkalinity_ta\n",
"total_dissolved_solids\n",
"transmission_percent\n",
"upward_sea_water_velocity\n",
"visibility_in_air\n",
"volume_attenuation_coefficient_of_downwelling_radiative_flux_in_sea_water\n",
"volume_beam_attenuation_coefficient_of_radiative_flux_in_sea_water\n",
"volume_fraction_of_oxygen_in_sea_water\n",
"water_surface_height_above_reference_datum\n",
"water_temperature_intragravel\n",
"webcam\n",
"wind_chill_temperature\n",
"wind_from_direction\n",
"wind_generator_current\n",
"wind_gust_from_direction\n",
"wind_speed\n",
"wind_speed_of_gust\n",
"wind_speed_samples\n",
"wind_to_direction\n",
"\n"
]
}
]
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "4RMRft05K9em"
},
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment