Skip to content

Commit

Permalink
Updated get instrument url functions for local file use
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-hampton committed Nov 25, 2024
1 parent d094e70 commit f2c16de
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions src/ncas_amof_netcdf_template/file_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,25 +338,33 @@ def _get_ncas_instrument_tsv_url(self) -> str:
"""
Get the URL for the tsv file of NCAS instruments
"""
vocab_version = self._get_github_latest_version(
"https://github.com/ncasuk/ncas-data-instrument-vocabs"
)
file_loc = (
"https://raw.githubusercontent.com/ncasuk/ncas-data-instrument-vocabs"
)
return f"{file_loc}/{vocab_version}/product-definitions/tsv/_instrument_vocabs/ncas-instrument-name-and-descriptors.tsv"
if self.use_local_files is not None:
main_loc = f"{self.use_local_files}/{self.tag}"
else:
vocab_version = self._get_github_latest_version(
"https://github.com/ncasuk/ncas-data-instrument-vocabs"
)
file_loc = (
"https://raw.githubusercontent.com/ncasuk/ncas-data-instrument-vocabs"
)
main_loc = f"{file_loc}/{vocab_version}"
return f"{main_loc}/product-definitions/tsv/_instrument_vocabs/ncas-instrument-name-and-descriptors.tsv"

def _get_community_instrument_tsv_url(self) -> str:
"""
Get the URL for the tsv file of NCAS instruments
"""
vocab_version = self._get_github_latest_version(
"https://github.com/ncasuk/ncas-data-instrument-vocabs"
)
file_loc = (
"https://raw.githubusercontent.com/ncasuk/ncas-data-instrument-vocabs"
)
return f"{file_loc}/{vocab_version}/product-definitions/tsv/_instrument_vocabs/community-instrument-name-and-descriptors.tsv"
if self.use_local_files is not None:
main_loc = f"{self.use_local_files}/{self.tag}"
else:
vocab_version = self._get_github_latest_version(
"https://github.com/ncasuk/ncas-data-instrument-vocabs"
)
file_loc = (
"https://raw.githubusercontent.com/ncasuk/ncas-data-instrument-vocabs"
)
main_loc = f"{file_loc}/{vocab_version}"
return f"{main_loc}/product-definitions/tsv/_instrument_vocabs/community-instrument-name-and-descriptors.tsv"


def convert_instrument_dict_to_file_info(
Expand Down

0 comments on commit f2c16de

Please sign in to comment.