You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been attempting debug my python script to download swh and ppd1 (as per Table 7: [https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Introduction]), I've implemented error statements to check for ppd1 and I'm having no luck. Is there a mismatch between the documentation and name on data set?
What are the steps to reproduce the bug?
import os
import cdsapi
import xarray as xr
import pandas as pd
import logging
from datetime import datetime, timedelta
from concurrent.futures import ThreadPoolExecutor, as_completed
import time
# Set up logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def validate_dates(start_date, end_date):
"""Validate that the start date is not after the end date."""
if start_date > end_date:
raise ValueError("Start date must be on or before end date.")
def generate_date_range(start_date, end_date):
"""Generate a list of dates between start_date and end_date."""
date_list = []
current_date = start_date
while current_date <= end_date:
date_list.append(current_date.strftime('%Y-%m-%d'))
current_date += timedelta(days=1)
return date_list
def download_era5_data(date_str):
"""Download ERA5 data for the given date."""
c = cdsapi.Client()
year, month, day = date_str.split('-')
filename = f"wave_data_{year}_{month}_{day}.nc"
# Retry mechanism for download failures
max_retries = 3
for attempt in range(max_retries):
try:
if not os.path.exists(filename):
logging.info(f"Downloading {filename}...")
c.retrieve(
'reanalysis-era5-single-levels',
{
'product_type': 'reanalysis',
'variable': [
'significant_height_of_combined_wind_waves_and_swell',
'peak_wave_period',
],
'year': year,
'month': month,
'day': day,
'time': [
'00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00',
'07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00',
'14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00',
'21:00', '22:00', '23:00'
],
'format': 'netcdf',
},
filename
)
else:
logging.info(f"{filename} already exists. Skipping download.")
return filename
except Exception as e:
logging.error(f"Error downloading {filename} on attempt {attempt + 1}: {e}")
time.sleep(5)
logging.error(f"Failed to download {filename} after {max_retries} attempts.")
return None
def process_file(file_path):
"""Process a single NetCDF file and extract relevant variables."""
logging.info(f"Processing file: {file_path}")
if not os.path.exists(file_path):
logging.error(f"File not found: {file_path}")
return None
try:
ds = xr.open_dataset(file_path)
logging.info(f"File opened successfully: {file_path}")
# Log and check variable names in the dataset
logging.info(f"Variables in dataset: {ds.variables.keys()}")
if 'swh' not in ds.variables:
logging.warning("Variable 'significant_height_of_combined_wind_waves_and_swell' or 'swh' not found.")
return None
if 'pp1d' not in ds.variables and 'peak_wave_period' not in ds.variables:
logging.warning("Variable 'peak_wave_period' or 'pp1d' not found.")
return None
# If variable names are not consistent, assign the correct ones
swh_var = ds['swh'] if 'swh' in ds.variables else ds['significant_height_of_combined_wind_waves_and_swell']
pp1d_var = ds['pp1d'] if 'pp1d' in ds.variables else ds['peak_wave_period']
return pd.DataFrame({
'time': ds['valid_time'].values,
'swh': swh_var.values.flatten(),
'pp1d': pp1d_var.values.flatten()
})
except Exception as e:
logging.error(f"Error processing file {file_path}: {e}")
return None
def reindex_to_common_grid(datasets):
"""Reindex datasets to a common grid."""
common_time = datasets[0]['time']
reindexed_datasets = []
for df in datasets:
try:
df = df.set_index('time').reindex(common_time)
reindexed_datasets.append(df)
except Exception as e:
logging.error(f"Error reindexing dataset: {e}")
return reindexed_datasets
def concatenate_datasets(datasets):
"""Concatenate datasets into a single DataFrame."""
try:
concatenated = pd.concat(datasets)
logging.info("Successfully concatenated datasets.")
return concatenated
except Exception as e:
logging.error(f"Error concatenating datasets: {e}")
return None
def save_to_csv(df, filename='combined_wave_data.csv'):
"""Save the combined DataFrame to a CSV file."""
if df is not None:
try:
df.to_csv(filename, index=False)
logging.info(f"Data saved to '{filename}'.")
except Exception as e:
logging.error(f"Error saving data to CSV: {e}")
def main(start_year, start_month, start_day, end_year, end_month, end_day):
"""Main function to download, process, and analyze data."""
start_date = datetime(start_year, start_month, start_day)
end_date = datetime(end_year, end_month, end_day)
validate_dates(start_date, end_date)
date_range = generate_date_range(start_date, end_date)
with ThreadPoolExecutor(max_workers=10) as executor:
future_to_date = {executor.submit(download_era5_data, date): date for date in date_range}
downloaded_files = []
for future in as_completed(future_to_date):
result = future.result()
if result:
downloaded_files.append(result)
if not downloaded_files:
logging.warning("No files were successfully downloaded.")
return
datasets = []
for file_path in downloaded_files:
df = process_file(file_path)
if df is not None:
datasets.append(df)
if datasets:
reindexed_datasets = reindex_to_common_grid(datasets)
concatenated_data = concatenate_datasets(reindexed_datasets)
save_to_csv(concatenated_data)
else:
logging.warning("No datasets to combine.")
# Run the main function with specified start and end dates
if __name__ == "__main__":
start_year = 2017
start_month = 1
start_day = 1
end_year = 2017
end_month = 1
end_day = 10
main(start_year, start_month, start_day, end_year, end_month, end_day)
Version
0.7.1
Platform (OS and architecture)
Windows 10
Relevant log output
024-08-26 16:48:49,535 - INFO - Processing file: wave_data_2017_01_10.nc
2024-08-26 16:48:49,614 - INFO - File opened successfully: wave_data_2017_01_10.nc
2024-08-26 16:48:49,617 - INFO - Variables in dataset: KeysView(Frozen({'number': <xarray.Variable ()> Size: 8B
[1 values with dtype=int64]
Attributes:
long_name: ensemble member numerical id
units: 1
standard_name: realization, 'valid_time': <xarray.IndexVariable 'valid_time' (valid_time: 24)> Size: 192B
array(['2017-01-10T00:00:00.000000000', '2017-01-10T01:00:00.000000000',
'2017-01-10T02:00:00.000000000', '2017-01-10T03:00:00.000000000',
'2017-01-10T04:00:00.000000000', '2017-01-10T05:00:00.000000000',
'2017-01-10T06:00:00.000000000', '2017-01-10T07:00:00.000000000',
'2017-01-10T08:00:00.000000000', '2017-01-10T09:00:00.000000000',
'2017-01-10T10:00:00.000000000', '2017-01-10T11:00:00.000000000',
'2017-01-10T12:00:00.000000000', '2017-01-10T13:00:00.000000000',
'2017-01-10T14:00:00.000000000', '2017-01-10T15:00:00.000000000',
'2017-01-10T16:00:00.000000000', '2017-01-10T17:00:00.000000000',
'2017-01-10T18:00:00.000000000', '2017-01-10T19:00:00.000000000',
'2017-01-10T20:00:00.000000000', '2017-01-10T21:00:00.000000000',
'2017-01-10T22:00:00.000000000', '2017-01-10T23:00:00.000000000'],
dtype='datetime64[ns]')
Attributes:
long_name: time
standard_name: time, 'latitude': <xarray.IndexVariable 'latitude' (latitude: 361)> Size: 3kB
array([ 90. , 89.5, 89. , ..., -89. , -89.5, -90. ])
Attributes:
units: degrees_north
standard_name: latitude
long_name: latitude
stored_direction: decreasing, 'longitude': <xarray.IndexVariable 'longitude' (longitude: 720)> Size: 6kB
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5])
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude, 'expver': <xarray.Variable (valid_time: 24)> Size: 384B
[24 values with dtype=<U4], 'swh': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140229
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: m
long_name: Significant height of combined ...
units: m
standard_name: unknown
GRIB_meanSea: 0.0, 'pp1d': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140231
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: s
long_name: Peak wave period
units: s
standard_name: unknown
GRIB_meanSea: 0.0}))
2024-08-26 16:48:49,828 - ERROR - Error processing file wave_data_2017_01_10.nc: All arrays must be of the same length
2024-08-26 16:48:49,841 - INFO - Processing file: wave_data_2017_01_08.nc
2024-08-26 16:48:49,858 - INFO - File opened successfully: wave_data_2017_01_08.nc
2024-08-26 16:48:49,860 - INFO - Variables in dataset: KeysView(Frozen({'number': <xarray.Variable ()> Size: 8B
[1 values with dtype=int64]
Attributes:
long_name: ensemble member numerical id
units: 1
standard_name: realization, 'valid_time': <xarray.IndexVariable 'valid_time' (valid_time: 24)> Size: 192B
array(['2017-01-08T00:00:00.000000000', '2017-01-08T01:00:00.000000000',
'2017-01-08T02:00:00.000000000', '2017-01-08T03:00:00.000000000',
'2017-01-08T04:00:00.000000000', '2017-01-08T05:00:00.000000000',
'2017-01-08T06:00:00.000000000', '2017-01-08T07:00:00.000000000',
'2017-01-08T08:00:00.000000000', '2017-01-08T09:00:00.000000000',
'2017-01-08T10:00:00.000000000', '2017-01-08T11:00:00.000000000',
'2017-01-08T12:00:00.000000000', '2017-01-08T13:00:00.000000000',
'2017-01-08T14:00:00.000000000', '2017-01-08T15:00:00.000000000',
'2017-01-08T16:00:00.000000000', '2017-01-08T17:00:00.000000000',
'2017-01-08T18:00:00.000000000', '2017-01-08T19:00:00.000000000',
'2017-01-08T20:00:00.000000000', '2017-01-08T21:00:00.000000000',
'2017-01-08T22:00:00.000000000', '2017-01-08T23:00:00.000000000'],
dtype='datetime64[ns]')
Attributes:
long_name: time
standard_name: time, 'latitude': <xarray.IndexVariable 'latitude' (latitude: 361)> Size: 3kB
array([ 90. , 89.5, 89. , ..., -89. , -89.5, -90. ])
Attributes:
units: degrees_north
standard_name: latitude
long_name: latitude
stored_direction: decreasing, 'longitude': <xarray.IndexVariable 'longitude' (longitude: 720)> Size: 6kB
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5])
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude, 'expver': <xarray.Variable (valid_time: 24)> Size: 384B
[24 values with dtype=<U4], 'swh': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140229
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: m
long_name: Significant height of combined ...
units: m
standard_name: unknown
GRIB_meanSea: 0.0, 'pp1d': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140231
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: s
long_name: Peak wave period
units: s
standard_name: unknown
GRIB_meanSea: 0.0}))
2024-08-26 16:48:50,067 - ERROR - Error processing file wave_data_2017_01_08.nc: All arrays must be of the same length
2024-08-26 16:48:50,080 - INFO - Processing file: wave_data_2017_01_05.nc
2024-08-26 16:48:50,097 - INFO - File opened successfully: wave_data_2017_01_05.nc
2024-08-26 16:48:50,099 - INFO - Variables in dataset: KeysView(Frozen({'number': <xarray.Variable ()> Size: 8B
[1 values with dtype=int64]
Attributes:
long_name: ensemble member numerical id
units: 1
standard_name: realization, 'valid_time': <xarray.IndexVariable 'valid_time' (valid_time: 24)> Size: 192B
array(['2017-01-05T00:00:00.000000000', '2017-01-05T01:00:00.000000000',
'2017-01-05T02:00:00.000000000', '2017-01-05T03:00:00.000000000',
'2017-01-05T04:00:00.000000000', '2017-01-05T05:00:00.000000000',
'2017-01-05T06:00:00.000000000', '2017-01-05T07:00:00.000000000',
'2017-01-05T08:00:00.000000000', '2017-01-05T09:00:00.000000000',
'2017-01-05T10:00:00.000000000', '2017-01-05T11:00:00.000000000',
'2017-01-05T12:00:00.000000000', '2017-01-05T13:00:00.000000000',
'2017-01-05T14:00:00.000000000', '2017-01-05T15:00:00.000000000',
'2017-01-05T16:00:00.000000000', '2017-01-05T17:00:00.000000000',
'2017-01-05T18:00:00.000000000', '2017-01-05T19:00:00.000000000',
'2017-01-05T20:00:00.000000000', '2017-01-05T21:00:00.000000000',
'2017-01-05T22:00:00.000000000', '2017-01-05T23:00:00.000000000'],
dtype='datetime64[ns]')
Attributes:
long_name: time
standard_name: time, 'latitude': <xarray.IndexVariable 'latitude' (latitude: 361)> Size: 3kB
array([ 90. , 89.5, 89. , ..., -89. , -89.5, -90. ])
Attributes:
units: degrees_north
standard_name: latitude
long_name: latitude
stored_direction: decreasing, 'longitude': <xarray.IndexVariable 'longitude' (longitude: 720)> Size: 6kB
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5])
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude, 'expver': <xarray.Variable (valid_time: 24)> Size: 384B
[24 values with dtype=<U4], 'swh': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140229
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: m
long_name: Significant height of combined ...
units: m
standard_name: unknown
GRIB_meanSea: 0.0, 'pp1d': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140231
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: s
long_name: Peak wave period
units: s
standard_name: unknown
GRIB_meanSea: 0.0}))
2024-08-26 16:48:50,304 - ERROR - Error processing file wave_data_2017_01_05.nc: All arrays must be of the same length
2024-08-26 16:48:50,319 - INFO - Processing file: wave_data_2017_01_01.nc
2024-08-26 16:48:50,335 - INFO - File opened successfully: wave_data_2017_01_01.nc
2024-08-26 16:48:50,337 - INFO - Variables in dataset: KeysView(Frozen({'number': <xarray.Variable ()> Size: 8B
[1 values with dtype=int64]
Attributes:
long_name: ensemble member numerical id
units: 1
standard_name: realization, 'valid_time': <xarray.IndexVariable 'valid_time' (valid_time: 24)> Size: 192B
array(['2017-01-01T00:00:00.000000000', '2017-01-01T01:00:00.000000000',
'2017-01-01T02:00:00.000000000', '2017-01-01T03:00:00.000000000',
'2017-01-01T04:00:00.000000000', '2017-01-01T05:00:00.000000000',
'2017-01-01T06:00:00.000000000', '2017-01-01T07:00:00.000000000',
'2017-01-01T08:00:00.000000000', '2017-01-01T09:00:00.000000000',
'2017-01-01T10:00:00.000000000', '2017-01-01T11:00:00.000000000',
'2017-01-01T12:00:00.000000000', '2017-01-01T13:00:00.000000000',
'2017-01-01T14:00:00.000000000', '2017-01-01T15:00:00.000000000',
'2017-01-01T16:00:00.000000000', '2017-01-01T17:00:00.000000000',
'2017-01-01T18:00:00.000000000', '2017-01-01T19:00:00.000000000',
'2017-01-01T20:00:00.000000000', '2017-01-01T21:00:00.000000000',
'2017-01-01T22:00:00.000000000', '2017-01-01T23:00:00.000000000'],
dtype='datetime64[ns]')
Attributes:
long_name: time
standard_name: time, 'latitude': <xarray.IndexVariable 'latitude' (latitude: 361)> Size: 3kB
array([ 90. , 89.5, 89. , ..., -89. , -89.5, -90. ])
Attributes:
units: degrees_north
standard_name: latitude
long_name: latitude
stored_direction: decreasing, 'longitude': <xarray.IndexVariable 'longitude' (longitude: 720)> Size: 6kB
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5])
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude, 'expver': <xarray.Variable (valid_time: 24)> Size: 384B
[24 values with dtype=<U4], 'swh': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140229
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: m
long_name: Significant height of combined ...
units: m
standard_name: unknown
GRIB_meanSea: 0.0, 'pp1d': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140231
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: s
long_name: Peak wave period
units: s
standard_name: unknown
GRIB_meanSea: 0.0}))
2024-08-26 16:48:50,539 - ERROR - Error processing file wave_data_2017_01_01.nc: All arrays must be of the same length
2024-08-26 16:48:50,553 - INFO - Processing file: wave_data_2017_01_06.nc
2024-08-26 16:48:50,570 - INFO - File opened successfully: wave_data_2017_01_06.nc
2024-08-26 16:48:50,571 - INFO - Variables in dataset: KeysView(Frozen({'number': <xarray.Variable ()> Size: 8B
[1 values with dtype=int64]
Attributes:
long_name: ensemble member numerical id
units: 1
standard_name: realization, 'valid_time': <xarray.IndexVariable 'valid_time' (valid_time: 24)> Size: 192B
array(['2017-01-06T00:00:00.000000000', '2017-01-06T01:00:00.000000000',
'2017-01-06T02:00:00.000000000', '2017-01-06T03:00:00.000000000',
'2017-01-06T04:00:00.000000000', '2017-01-06T05:00:00.000000000',
'2017-01-06T06:00:00.000000000', '2017-01-06T07:00:00.000000000',
'2017-01-06T08:00:00.000000000', '2017-01-06T09:00:00.000000000',
'2017-01-06T10:00:00.000000000', '2017-01-06T11:00:00.000000000',
'2017-01-06T12:00:00.000000000', '2017-01-06T13:00:00.000000000',
'2017-01-06T14:00:00.000000000', '2017-01-06T15:00:00.000000000',
'2017-01-06T16:00:00.000000000', '2017-01-06T17:00:00.000000000',
'2017-01-06T18:00:00.000000000', '2017-01-06T19:00:00.000000000',
'2017-01-06T20:00:00.000000000', '2017-01-06T21:00:00.000000000',
'2017-01-06T22:00:00.000000000', '2017-01-06T23:00:00.000000000'],
dtype='datetime64[ns]')
Attributes:
long_name: time
standard_name: time, 'latitude': <xarray.IndexVariable 'latitude' (latitude: 361)> Size: 3kB
array([ 90. , 89.5, 89. , ..., -89. , -89.5, -90. ])
Attributes:
units: degrees_north
standard_name: latitude
long_name: latitude
stored_direction: decreasing, 'longitude': <xarray.IndexVariable 'longitude' (longitude: 720)> Size: 6kB
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5])
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude, 'expver': <xarray.Variable (valid_time: 24)> Size: 384B
[24 values with dtype=<U4], 'swh': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140229
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: m
long_name: Significant height of combined ...
units: m
standard_name: unknown
GRIB_meanSea: 0.0, 'pp1d': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140231
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: s
long_name: Peak wave period
units: s
standard_name: unknown
GRIB_meanSea: 0.0}))
2024-08-26 16:48:50,775 - ERROR - Error processing file wave_data_2017_01_06.nc: All arrays must be of the same length
2024-08-26 16:48:50,787 - INFO - Processing file: wave_data_2017_01_09.nc
2024-08-26 16:48:50,804 - INFO - File opened successfully: wave_data_2017_01_09.nc
2024-08-26 16:48:50,806 - INFO - Variables in dataset: KeysView(Frozen({'number': <xarray.Variable ()> Size: 8B
[1 values with dtype=int64]
Attributes:
long_name: ensemble member numerical id
units: 1
standard_name: realization, 'valid_time': <xarray.IndexVariable 'valid_time' (valid_time: 24)> Size: 192B
array(['2017-01-09T00:00:00.000000000', '2017-01-09T01:00:00.000000000',
'2017-01-09T02:00:00.000000000', '2017-01-09T03:00:00.000000000',
'2017-01-09T04:00:00.000000000', '2017-01-09T05:00:00.000000000',
'2017-01-09T06:00:00.000000000', '2017-01-09T07:00:00.000000000',
'2017-01-09T08:00:00.000000000', '2017-01-09T09:00:00.000000000',
'2017-01-09T10:00:00.000000000', '2017-01-09T11:00:00.000000000',
'2017-01-09T12:00:00.000000000', '2017-01-09T13:00:00.000000000',
'2017-01-09T14:00:00.000000000', '2017-01-09T15:00:00.000000000',
'2017-01-09T16:00:00.000000000', '2017-01-09T17:00:00.000000000',
'2017-01-09T18:00:00.000000000', '2017-01-09T19:00:00.000000000',
'2017-01-09T20:00:00.000000000', '2017-01-09T21:00:00.000000000',
'2017-01-09T22:00:00.000000000', '2017-01-09T23:00:00.000000000'],
dtype='datetime64[ns]')
Attributes:
long_name: time
standard_name: time, 'latitude': <xarray.IndexVariable 'latitude' (latitude: 361)> Size: 3kB
array([ 90. , 89.5, 89. , ..., -89. , -89.5, -90. ])
Attributes:
units: degrees_north
standard_name: latitude
long_name: latitude
stored_direction: decreasing, 'longitude': <xarray.IndexVariable 'longitude' (longitude: 720)> Size: 6kB
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5])
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude, 'expver': <xarray.Variable (valid_time: 24)> Size: 384B
[24 values with dtype=<U4], 'swh': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140229
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: m
long_name: Significant height of combined ...
units: m
standard_name: unknown
GRIB_meanSea: 0.0, 'pp1d': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140231
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: s
long_name: Peak wave period
units: s
standard_name: unknown
GRIB_meanSea: 0.0}))
2024-08-26 16:48:51,049 - ERROR - Error processing file wave_data_2017_01_09.nc: All arrays must be of the same length
2024-08-26 16:48:51,062 - INFO - Processing file: wave_data_2017_01_04.nc
2024-08-26 16:48:51,079 - INFO - File opened successfully: wave_data_2017_01_04.nc
2024-08-26 16:48:51,081 - INFO - Variables in dataset: KeysView(Frozen({'number': <xarray.Variable ()> Size: 8B
[1 values with dtype=int64]
Attributes:
long_name: ensemble member numerical id
units: 1
standard_name: realization, 'valid_time': <xarray.IndexVariable 'valid_time' (valid_time: 24)> Size: 192B
array(['2017-01-04T00:00:00.000000000', '2017-01-04T01:00:00.000000000',
'2017-01-04T02:00:00.000000000', '2017-01-04T03:00:00.000000000',
'2017-01-04T04:00:00.000000000', '2017-01-04T05:00:00.000000000',
'2017-01-04T06:00:00.000000000', '2017-01-04T07:00:00.000000000',
'2017-01-04T08:00:00.000000000', '2017-01-04T09:00:00.000000000',
'2017-01-04T10:00:00.000000000', '2017-01-04T11:00:00.000000000',
'2017-01-04T12:00:00.000000000', '2017-01-04T13:00:00.000000000',
'2017-01-04T14:00:00.000000000', '2017-01-04T15:00:00.000000000',
'2017-01-04T16:00:00.000000000', '2017-01-04T17:00:00.000000000',
'2017-01-04T18:00:00.000000000', '2017-01-04T19:00:00.000000000',
'2017-01-04T20:00:00.000000000', '2017-01-04T21:00:00.000000000',
'2017-01-04T22:00:00.000000000', '2017-01-04T23:00:00.000000000'],
dtype='datetime64[ns]')
Attributes:
long_name: time
standard_name: time, 'latitude': <xarray.IndexVariable 'latitude' (latitude: 361)> Size: 3kB
array([ 90. , 89.5, 89. , ..., -89. , -89.5, -90. ])
Attributes:
units: degrees_north
standard_name: latitude
long_name: latitude
stored_direction: decreasing, 'longitude': <xarray.IndexVariable 'longitude' (longitude: 720)> Size: 6kB
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5])
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude, 'expver': <xarray.Variable (valid_time: 24)> Size: 384B
[24 values with dtype=<U4], 'swh': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140229
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: m
long_name: Significant height of combined ...
units: m
standard_name: unknown
GRIB_meanSea: 0.0, 'pp1d': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140231
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: s
long_name: Peak wave period
units: s
standard_name: unknown
GRIB_meanSea: 0.0}))
2024-08-26 16:48:51,286 - ERROR - Error processing file wave_data_2017_01_04.nc: All arrays must be of the same length
2024-08-26 16:48:51,299 - INFO - Processing file: wave_data_2017_01_02.nc
2024-08-26 16:48:51,317 - INFO - File opened successfully: wave_data_2017_01_02.nc
2024-08-26 16:48:51,318 - INFO - Variables in dataset: KeysView(Frozen({'number': <xarray.Variable ()> Size: 8B
[1 values with dtype=int64]
Attributes:
long_name: ensemble member numerical id
units: 1
standard_name: realization, 'valid_time': <xarray.IndexVariable 'valid_time' (valid_time: 24)> Size: 192B
array(['2017-01-02T00:00:00.000000000', '2017-01-02T01:00:00.000000000',
'2017-01-02T02:00:00.000000000', '2017-01-02T03:00:00.000000000',
'2017-01-02T04:00:00.000000000', '2017-01-02T05:00:00.000000000',
'2017-01-02T06:00:00.000000000', '2017-01-02T07:00:00.000000000',
'2017-01-02T08:00:00.000000000', '2017-01-02T09:00:00.000000000',
'2017-01-02T10:00:00.000000000', '2017-01-02T11:00:00.000000000',
'2017-01-02T12:00:00.000000000', '2017-01-02T13:00:00.000000000',
'2017-01-02T14:00:00.000000000', '2017-01-02T15:00:00.000000000',
'2017-01-02T16:00:00.000000000', '2017-01-02T17:00:00.000000000',
'2017-01-02T18:00:00.000000000', '2017-01-02T19:00:00.000000000',
'2017-01-02T20:00:00.000000000', '2017-01-02T21:00:00.000000000',
'2017-01-02T22:00:00.000000000', '2017-01-02T23:00:00.000000000'],
dtype='datetime64[ns]')
Attributes:
long_name: time
standard_name: time, 'latitude': <xarray.IndexVariable 'latitude' (latitude: 361)> Size: 3kB
array([ 90. , 89.5, 89. , ..., -89. , -89.5, -90. ])
Attributes:
units: degrees_north
standard_name: latitude
long_name: latitude
stored_direction: decreasing, 'longitude': <xarray.IndexVariable 'longitude' (longitude: 720)> Size: 6kB
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5])
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude, 'expver': <xarray.Variable (valid_time: 24)> Size: 384B
[24 values with dtype=<U4], 'swh': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140229
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: m
long_name: Significant height of combined ...
units: m
standard_name: unknown
GRIB_meanSea: 0.0, 'pp1d': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140231
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: s
long_name: Peak wave period
units: s
standard_name: unknown
GRIB_meanSea: 0.0}))
2024-08-26 16:48:51,526 - ERROR - Error processing file wave_data_2017_01_02.nc: All arrays must be of the same length
2024-08-26 16:48:51,541 - INFO - Processing file: wave_data_2017_01_07.nc
2024-08-26 16:48:51,558 - INFO - File opened successfully: wave_data_2017_01_07.nc
2024-08-26 16:48:51,560 - INFO - Variables in dataset: KeysView(Frozen({'number': <xarray.Variable ()> Size: 8B
[1 values with dtype=int64]
Attributes:
long_name: ensemble member numerical id
units: 1
standard_name: realization, 'valid_time': <xarray.IndexVariable 'valid_time' (valid_time: 24)> Size: 192B
array(['2017-01-07T00:00:00.000000000', '2017-01-07T01:00:00.000000000',
'2017-01-07T02:00:00.000000000', '2017-01-07T03:00:00.000000000',
'2017-01-07T04:00:00.000000000', '2017-01-07T05:00:00.000000000',
'2017-01-07T06:00:00.000000000', '2017-01-07T07:00:00.000000000',
'2017-01-07T08:00:00.000000000', '2017-01-07T09:00:00.000000000',
'2017-01-07T10:00:00.000000000', '2017-01-07T11:00:00.000000000',
'2017-01-07T12:00:00.000000000', '2017-01-07T13:00:00.000000000',
'2017-01-07T14:00:00.000000000', '2017-01-07T15:00:00.000000000',
'2017-01-07T16:00:00.000000000', '2017-01-07T17:00:00.000000000',
'2017-01-07T18:00:00.000000000', '2017-01-07T19:00:00.000000000',
'2017-01-07T20:00:00.000000000', '2017-01-07T21:00:00.000000000',
'2017-01-07T22:00:00.000000000', '2017-01-07T23:00:00.000000000'],
dtype='datetime64[ns]')
Attributes:
long_name: time
standard_name: time, 'latitude': <xarray.IndexVariable 'latitude' (latitude: 361)> Size: 3kB
array([ 90. , 89.5, 89. , ..., -89. , -89.5, -90. ])
Attributes:
units: degrees_north
standard_name: latitude
long_name: latitude
stored_direction: decreasing, 'longitude': <xarray.IndexVariable 'longitude' (longitude: 720)> Size: 6kB
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5])
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude, 'expver': <xarray.Variable (valid_time: 24)> Size: 384B
[24 values with dtype=<U4], 'swh': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140229
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: m
long_name: Significant height of combined ...
units: m
standard_name: unknown
GRIB_meanSea: 0.0, 'pp1d': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140231
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: s
long_name: Peak wave period
units: s
standard_name: unknown
GRIB_meanSea: 0.0}))
2024-08-26 16:48:51,762 - ERROR - Error processing file wave_data_2017_01_07.nc: All arrays must be of the same length
2024-08-26 16:48:51,775 - INFO - Processing file: wave_data_2017_01_03.nc
2024-08-26 16:48:51,793 - INFO - File opened successfully: wave_data_2017_01_03.nc
2024-08-26 16:48:51,794 - INFO - Variables in dataset: KeysView(Frozen({'number': <xarray.Variable ()> Size: 8B
[1 values with dtype=int64]
Attributes:
long_name: ensemble member numerical id
units: 1
standard_name: realization, 'valid_time': <xarray.IndexVariable 'valid_time' (valid_time: 24)> Size: 192B
array(['2017-01-03T00:00:00.000000000', '2017-01-03T01:00:00.000000000',
'2017-01-03T02:00:00.000000000', '2017-01-03T03:00:00.000000000',
'2017-01-03T04:00:00.000000000', '2017-01-03T05:00:00.000000000',
'2017-01-03T06:00:00.000000000', '2017-01-03T07:00:00.000000000',
'2017-01-03T08:00:00.000000000', '2017-01-03T09:00:00.000000000',
'2017-01-03T10:00:00.000000000', '2017-01-03T11:00:00.000000000',
'2017-01-03T12:00:00.000000000', '2017-01-03T13:00:00.000000000',
'2017-01-03T14:00:00.000000000', '2017-01-03T15:00:00.000000000',
'2017-01-03T16:00:00.000000000', '2017-01-03T17:00:00.000000000',
'2017-01-03T18:00:00.000000000', '2017-01-03T19:00:00.000000000',
'2017-01-03T20:00:00.000000000', '2017-01-03T21:00:00.000000000',
'2017-01-03T22:00:00.000000000', '2017-01-03T23:00:00.000000000'],
dtype='datetime64[ns]')
Attributes:
long_name: time
standard_name: time, 'latitude': <xarray.IndexVariable 'latitude' (latitude: 361)> Size: 3kB
array([ 90. , 89.5, 89. , ..., -89. , -89.5, -90. ])
Attributes:
units: degrees_north
standard_name: latitude
long_name: latitude
stored_direction: decreasing, 'longitude': <xarray.IndexVariable 'longitude' (longitude: 720)> Size: 6kB
array([ 0. , 0.5, 1. , ..., 358.5, 359. , 359.5])
Attributes:
units: degrees_east
standard_name: longitude
long_name: longitude, 'expver': <xarray.Variable (valid_time: 24)> Size: 384B
[24 values with dtype=<U4], 'swh': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140229
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: m
long_name: Significant height of combined ...
units: m
standard_name: unknown
GRIB_meanSea: 0.0, 'pp1d': <xarray.Variable (valid_time: 24, latitude: 361, longitude: 720)> Size: 25MB
[6238080 values with dtype=float32]
Attributes: (12/32)
GRIB_paramId: 140231
GRIB_dataType: an
GRIB_numberOfPoints: 259920
GRIB_typeOfLevel: meanSea
GRIB_stepUnits: 1
GRIB_stepType: instant
... ...
GRIB_totalNumber: 0
GRIB_units: s
long_name: Peak wave period
units: s
standard_name: unknown
GRIB_meanSea: 0.0}))
2024-08-26 16:48:52,003 - ERROR - Error processing file wave_data_2017_01_03.nc: All arrays must be of the same length
2024-08-26 16:48:52,017 - WARNING - No datasets to combine.
Accompanying data
No response
Organisation
University of Edinburgh
The text was updated successfully, but these errors were encountered:
What happened?
I've been attempting debug my python script to download swh and ppd1 (as per Table 7: [https://confluence.ecmwf.int/display/CKB/ERA5%3A+data+documentation#ERA5:datadocumentation-Introduction]), I've implemented error statements to check for ppd1 and I'm having no luck. Is there a mismatch between the documentation and name on data set?
What are the steps to reproduce the bug?
Version
0.7.1
Platform (OS and architecture)
Windows 10
Relevant log output
Accompanying data
No response
Organisation
University of Edinburgh
The text was updated successfully, but these errors were encountered: