Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmorise cci lst v3 #3656

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a74c966
cmorizer python and yml config file added
Apr 3, 2024
4985426
All variables now included
Apr 3, 2024
bdc92b5
Simple diagnostic to test CMORized V3 data. Not best practice but pri…
Apr 3, 2024
45438fb
Correct DAY to NIGHT for tsNight variable in the filename
Apr 11, 2024
d634622
Flake8 and yamllint tidy of code
Apr 19, 2024
c85cce0
minor edits
Apr 19, 2024
6ba03d3
try/except added around load_cubes to prevent missing or bad files cr…
Apr 24, 2024
224d890
Add Total uncertainty and LST Variance
May 16, 2024
ed18b08
update to run 2003-2018 land cover for MODISA
May 16, 2024
e239ec5
Attempt to fix long int error in LC variable
May 17, 2024
09484bd
try normal array for LC instead of masked arry
May 17, 2024
409ec28
using np.float32 to try and solve issue
May 17, 2024
3babc17
trying to remove any values in LC outside 0-255
May 17, 2024
f4191a0
Another thing to try solve the int issue
May 22, 2024
c279353
try plus zero to keep as int
May 22, 2024
7501183
Revert to *1.0 and a tidy
May 22, 2024
8a6de39
Testing, probably wont need
May 23, 2024
df03155
Tidy ready for PR
Jun 18, 2024
b70455c
Update datasets.yml to reflect LST V3 and CEDA as source
Jun 18, 2024
6a6bfd5
Reference and check_obs updated
Jun 18, 2024
d58aefa
Update to address some Codacy issues
Jun 19, 2024
616ac09
Removed unused lst_testing.py
Jun 19, 2024
94726a4
Codacy fixes
Jun 19, 2024
1043ab2
f string error fixed
Jun 21, 2024
234a21b
added downloader for ESACCI-LST
axel-lauer Jun 25, 2024
766a025
Merge branch 'main' into cmorise_cci_lst_v3
valeriupredoi Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 127 additions & 11 deletions esmvaltool/cmorizers/data/cmor_config/ESACCI-LST.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# CMORIZE ESA CCI LST
# Follwing CRU and ESACCI-OC as examples
# Only looking at AQUA MONTHLY data but python has placeholders for different platforms
# CMORIZE ESA CCI LST - V3
# Only looking at AQUA MODIS MONTHLY
---


# Common global attributes for Cmorizer output
attributes:
dataset_id: ESACCI-LST
version: '1.00'
version: '3.00'
tier: 2
project_id: OBS
source: 'ESA CCI'
Expand All @@ -20,12 +18,130 @@ attributes:
# Variables to cmorize
# These go into the vals dictionary in the python script
variables:
ts:
tsLCDay:
mip: Amon
raw: land cover class
raw_units:
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_DAY-'
start_year: 2003
end_year: 2018

tsLCNight:
mip: Amon
raw: land cover class
raw_units:
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_NIGHT-'
start_year: 2003
end_year: 2018

tsTotalDay:
mip: Amon
raw: land surface temperature total uncertainty
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_DAY-'
start_year: 2003
end_year: 2018

tsTotalNight:
mip: Amon
raw: land surface temperature total uncertainty
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_NIGHT-'
start_year: 2003
end_year: 2018

tsVarDay:
mip: Amon
raw: land surface temperature variance
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_DAY-'
start_year: 2003
end_year: 2018

tsVarNight:
mip: Amon
raw: land surface temperature variance
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_NIGHT-'
start_year: 2003
end_year: 2018

tsDay:
mip: Amon
raw: land surface temperature
raw_units: kelvin
file_day: 'ESACCI-LST-L3C-LST-MODISA-0.05deg_1MONTHLY_DAY-'
file_night: 'ESACCI-LST-L3C-LST-MODISA-0.05deg_1MONTHLY_NIGHT-'
# plan to make it possible to change MODISA here but only placeholders in the python there for now
# Period covered: 2003-2018
# 2003 Only has data from July onwards for Aqua MODIS
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_DAY-'
start_year: 2003
end_year: 2018

tsNight:
mip: Amon
raw: land surface temperature
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_NIGHT-'
start_year: 2003
end_year: 2018

tsLocalAtmErrDay:
mip: Amon
raw: uncertainty from locally correlated errors on atmospheric scales
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_DAY-'
start_year: 2003
end_year: 2018

tsLocalAtmErrNight:
mip: Amon
raw: uncertainty from locally correlated errors on atmospheric scales
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_NIGHT-'
start_year: 2003
end_year: 2018

tsLocalSfcErrDay:
mip: Amon
raw: uncertainty from locally correlated errors on surface scales
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_DAY-'
start_year: 2003
end_year: 2018

tsLocalSfcErrNight:
mip: Amon
raw: uncertainty from locally correlated errors on surface scales
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_NIGHT-'
start_year: 2003
end_year: 2018

tsLSSysErrDay:
mip: Amon
raw: uncertainty from large-scale systematic errors
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_DAY-'
start_year: 2003
end_year: 2018

tsLSSysErrNight:
mip: Amon
raw: uncertainty from large-scale systematic errors
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_NIGHT-'
start_year: 2003
end_year: 2018

tsUnCorErrDay:
mip: Amon
raw: uncertainty from uncorrelated errors
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_DAY-'
start_year: 2003
end_year: 2018

tsUnCorErrNight:
mip: Amon
raw: uncertainty from uncorrelated errors
raw_units: kelvin
file: 'ESACCI-LST-L3C-LST-MODISA-0.01deg_1MONTHLY_NIGHT-'
start_year: 2003
end_year: 2018
10 changes: 5 additions & 5 deletions esmvaltool/cmorizers/data/datasets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -494,18 +494,18 @@ datasets:

ESACCI-LST:
tier: 2
source: On CEDA-JASMIN, /gws/nopw/j04/esacci_lst/public
last_access: 2022-01-26
source: CEDA
last_access: 2024-06-18
info: |
For access to this JASMIN group workspace please register at:
https://accounts.jasmin.ac.uk/services/group_workspaces/esacci_lst/
Download the netCDF files from:
https://data.ceda.ac.uk/neodc/esacci/land_surface_temperature/data/AQUA_MODIS/L3C/0.01/v3.00/monthly
Download and processing instructions:
Put all files under a single directory (no subdirectories with years)
in ${RAWOBS}/Tier2/ESACCI-LST
BOTH DAY and NIGHT files are needed for each month

Caveats
Currently set to work with only the MODIS AQUA L3 monthly data
Currently set to work with only the MODIS AQUA L3 monthly data (MODISA)

ESACCI-OC:
tier: 2
Expand Down
90 changes: 90 additions & 0 deletions esmvaltool/cmorizers/data/downloaders/datasets/esacci_lst.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"""Script to download ESACCI-LST from CCI CEDA ftp."""

import logging

from datetime import datetime

from dateutil import relativedelta

from esmvaltool.cmorizers.data.downloaders.ftp import CCIDownloader

logger = logging.getLogger(__name__)


def download_dataset(config, dataset, dataset_info, start_date, end_date,
overwrite):
"""Download dataset.

Parameters
----------
config : dict
ESMValTool's user configuration
dataset : str
Name of the dataset
dataset_info : dict
Dataset information from the datasets.yml file
start_date : datetime
Start of the interval to download
end_date : datetime
End of the interval to download
overwrite : bool
Overwrite already downloaded files
"""
if start_date is None:
start_date = datetime(2003, 1, 1)
if end_date is None:
end_date = datetime(2018, 12, 31)
loop_date = start_date

downloader = CCIDownloader(
config=config,
dataset=dataset,
dataset_info=dataset_info,
overwrite=overwrite,
dataset_name='land_surface_temperature',
)
downloader.connect()

# download daily data

# loop_date = start_date
# rel_base_dir = 'AQUA_MODIS/L3C/0.01/v3.00/daily'
# while loop_date <= end_date:
# downloader.set_cwd(rel_base_dir)
# if downloader.exists(f'{loop_date.year}'):
# downloader.set_cwd(f'{rel_base_dir}/{loop_date.year}')
# if downloader.exists(f'{loop_date.month:02}'):
# downloader.set_cwd(f'{rel_base_dir}/{loop_date.year}/'
# f'{loop_date.month:02}')
# if downloader.exists(f'{loop_date.day:02}'):
# downloader.download_folder(f'{loop_date.day:02}',
# sub_folder=f'{loop_date.year}_daily')
# else:
# logger.info('%d/%d/%d: no data found', loop_date.year,
# loop_date.month, loop_date.day)
# loop_date += relativedelta.relativedelta(days=1)
# else:
# logger.info('%d/%d: no data found', loop_date.year,
# loop_date.month)
# loop_date += relativedelta.relativedelta(months=1)
# else:
# logger.info('%d: no data found', loop_date.year)
# loop_date += relativedelta.relativedelta(years=1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd be useful to either remove commented out code, if you know for sure it's not needed no more, or place in a callable function/object so that it can be used at a later stage


# download monthly data

loop_date = start_date
rel_base_dir = 'AQUA_MODIS/L3C/0.01/v3.00/monthly'
while loop_date <= end_date:
downloader.set_cwd(rel_base_dir)
if downloader.exists(f'{loop_date.year}'):
downloader.set_cwd(f'{rel_base_dir}/{loop_date.year}')
if downloader.exists(f'{loop_date.month:02}'):
downloader.download_folder(f'{loop_date.month:02}')
else:
logger.info('%d/%d: no data found', loop_date.year,
loop_date.month)
loop_date += relativedelta.relativedelta(months=1)
else:
logger.info('%d: no data found', loop_date.year)
loop_date += relativedelta.relativedelta(years=1)
11 changes: 9 additions & 2 deletions esmvaltool/cmorizers/data/downloaders/ftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,18 @@ class CCIDownloader(FTPDownloader):
Dataset information from the datasets.yml file
overwrite : bool
Overwrite already downloaded files
dataset_name : str
optional override for directory name on CEDA within
'esacci' folder
"""
def __init__(self, config, dataset, dataset_info, overwrite):
def __init__(self, config, dataset, dataset_info, overwrite,
dataset_name=None):
super().__init__(config, 'anon-ftp.ceda.ac.uk', dataset, dataset_info,
overwrite)
self.ftp_name = self.dataset_name[7:]
if dataset_name:
self.ftp_name = dataset_name
else:
self.ftp_name = self.dataset_name[7:]

def set_cwd(self, path):
"""Set current work directory.
Expand Down
Loading