task_categories:time-series-forecasting size_categories:100M<n<1B license:eupl-1.1 climate region:us
---
license: eupl-1.1
task_categories:
- time-series-forecasting
tags:
- climate
size_categories:
- 100M<n<1B
---

# Dataset Summary
Contains hourly 2 meters of land (on-shore) air temperature data within grid areas of Thailand country. <br/>
Data is retrieved from [Corpernicus Climate Data Store](https://cds.climate.copernicus.eu/cdsapp#!/home) on [ERA5-Land hourly data from 1950 to present](https://cds.climate.copernicus.eu/cdsapp#!/dataset/10.24381/cds.e2161bac?tab=overview)
 <br/>
Thailand areas in this context is **Latitude** = **[5.77434, 20.43353]** and **Longitude** = **[97.96852, 105.22908]** <br/>
For more details of data, you can refer to [ERA5-Land hourly data from 1950 to present](https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-land?tab=overview)
- Data Granularity: Hourly per Latitude/ Longitude
- Period: **31/Dec/1999** - **08/May/2023**
- Temperature Unit: Celsius (°C) (Original data from [ERA5-Land hourly data from 1950 to present](https://cds.climate.copernicus.eu/cdsapp#!/dataset/10.24381/cds.e2161bac?tab=overview) is Kelvin)

# Source Data
- Organization of the producer: ECMWF

# Data Creation
Below is an example of how to make data query using Python via [CDS API](https://cds.climate.copernicus.eu/api-how-to) in monthly requests. <br/>
Script can be found [here](https://huggingface.co/datasets/WasuratS/ECMWF_Thailand_Land_Air_Temperatures/blob/main/cds_api_requestor_example.py)

``` python
import cdsapi
c = cdsapi.Client()

month_list = [str(num).zfill(2) for num in range(1, 13)]
day_list = [str(num).zfill(2) for num in range(1, 32)]
time_list = [str(num).zfill(2) + ":00" for num in range(0, 24)]
year_list = [str(num) for num in range(2000, 2022)]

for year in year_list:
    for month in month_list:
        c.retrieve('reanalysis-era5-land',
        {
            'variable': [
                '2m_temperature']
        ,
        'year': year,
        'month' : month,
        'day': day_list,
        'time': time_list,
        'format': 'grib',
        'area': [
                    20.43, 97.96, 5.77,
                    105.22,
                ],
                },
        f'{year}_{month}_hourly_2m_temp_TH.grib')
```
Direct file output from API is in ```.grib``` format, to make it easy for further analysis work, I have converted it to ```.parquet``` format. <br/>
To convert GRIB format to pandas dataframe, you can use [xrray](https://github.com/pydata/xarray) and [cfgrib](https://github.com/ecmwf/cfgrib) library to help as below example snippet of code.

``` python
import xarray as xr
import cfgrib

ds = xr.open_dataset('2022_12_31_hourly_2m_temp_TH.grib', engine='cfgrib')
df = ds.to_dataframe().reset_index()

```




## Licensing
[Climate Data Store Product Licensing](https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf)

## Citation
- This data was generated using **Copernicus Climate Change Service** information and <br/>
contains modified **Copernicus Climate Change Service** information on 1999/Dec/31 - 2023/May/08 data period

- Muñoz Sabater, J. (2019): ERA5-Land hourly data from 1950 to present. <br/>
Copernicus Climate Change Service (C3S) Climate Data Store (CDS). <br/>
DOI: [10.24381/cds.e2161bac](https://cds.climate.copernicus.eu/cdsapp#!/dataset/10.24381/cds.e2161bac?tab=overview) (Accessed on 13-May-2023)

- Copernicus Climate Change Service (C3S) (2022): ERA5-Land hourly data from 1950 to present. <br/>
Copernicus Climate Change Service (C3S) Climate Data Store (CDS). <br/>
DOI: [10.24381/cds.e2161bac](https://cds.climate.copernicus.eu/cdsapp#!/dataset/10.24381/cds.e2161bac?tab=overview) (Accessed on 13-May-2023)