Closed gmandorl closed 2 months ago
The source coordinate is only added when the time coordinate is not present in the original files. I'll take a look later today. Most of the times it is possible to infer the time coordinate from the attributes of the original files.
Hi @gmandorl,
Yes, it's the problem I mentioned this morning. Try this:
from c3s_eqc_automatic_quality_control import download
import pandas as pd
collection_id = "satellite-cloud-properties"
ds_cci_month = {
"origin": "esa",
"variable": ["all_variables"],
"sensor_on_satellite": ["aatsr_on_envisat"],
"climate_data_record_type": "thematic_climate_data_record",
"product_family": "cci",
"time_aggregation": "monthly_mean",
"year": ["2010", "2011"],
"month": ["01", "02", "03", "04", "05"],
"area": [10, 170, 0, 180],
}
def preprocess(ds):
time = pd.to_datetime(ds.attrs["time_coverage_start"])
return ds.assign_coords(time=time)
ds_cci_month = download.download_and_transform(
collection_id,
ds_cci_month,
preprocess=preprocess,
)
Let me know if it works OK!
(There was a small typo in my snippet, so I edited it)
Hi @malmans2
Thank you very much, the code works well now.
What happened?
Hi!
I am trying to download the CCI dataset of cloud.
The 'download_and_transform' function works, however, the output dataset do not contain the coordinate "time" in the right format. I get instead a coordinate named "source" with strings.
Why is it happening? Is there a way to transform those strings back in datetime (or in seconds from 1970 as reported in the documentation)?
source_coordinate.zip
Minimal Complete Verifiable Example
No response
Relevant log output
No response
Anything else we need to know?
No response
Environment