Replies: 1 comment
-
Hello @msw09090, great question. python-cmethods is designed to be used with NetCDF-based data sets, so you'll need to convert your CSV data into NetCDF. For this you could use pandas and xarray for loading the CSV file, assigning the lats and lons (and time dimension) + saving it to a dataset. Simplified and not tested example, you may need to perform further steps, depending on the data: # Python script
import pandas as pd
import numpy as np
scenario = xr.open_dataset("scenario.nc")
# Extract the grid
lats = scenario['latitude']
lons = scenario['longitude']
# Load the CSV data
csv_data = pd.read_csv("temperature_data.csv")
temperature_values = csv_data['temperature'].values # assuming there is a head with this value
# Assume the temperature data is static and spans the grid only once
temperature_grid = temperature_values.reshape(len(lats), len(lons))
# Create an xarray Dataset
ds = xr.Dataset(
{
"temperature": (["latitude", "longitude"], temperature_grid)
},
coords={
"latitude": lats,
"longitude": lons,
}
)
# Save as NetCDF
ds.to_netcdf("temperature_data.nc")
# ... after that you can use the `ds`/dataset for applying bias correction methods. The bias adjustment techniques covered in this package are designed to be applied to thee data sets, two of them covering a "historical" time range, the so-called reference period, where one data set is the reference data/observations/reanalysis data and the other is modeled data. These two data sets are then used to bias-adjust a scenario/future/predicted time series. Using only two datasets is possible, but the results may lack strong statistical significance. |
Beta Was this translation helpful? Give feedback.
-
Hello,
Not a problem, but a question/request.
Let's say I have the following;
Using python-cmethods, is it possible to train/build an algorithm from (1; .csv file representing station observations and predictions) then apply it to (2; just representing predictions)?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions