Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
akarich73 committed Nov 22, 2024
1 parent 4df2531 commit 9bc4a66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,16 @@ The following links provide an example of the urls:
>Or as grid points to get CSV files for ua50m wind speed:
>https://thredds.nci.org.au/thredds/ncss/grid/ob53/output/reanalysis/AUS-11/BOM/ERA5/historical/hres/BARRA-R2/v1/1hr/ua50m/latest/ua50m_AUS-11_ERA5_historical_hres_BOM_BARRA-R2_v1_1hr_197901-197901.nc?var=ua50m&latitude=-36&longitude=140&time_start=1979-01-01T00%3A00%3A00Z&time_end=1979-01-31T23%3A00%3A00Z&timeStride=&vertCoord=&accept=csv
Reference for downloading from thredds is provided here:
https://opus.nci.org.au/display/DAE/examples-thredds

For a full list of BARRA2 variables refer to the BARRA2 FAQ:
https://opus.nci.org.au/pages/viewpage.action?pageId=264241306

Refer to BARRA2 documentation for further details:
https://opus.nci.org.au/pages/viewpage.action?pageId=264241166


## Features

- Point data download to closest node from BARRA2 AUS-11 Reanalysis data
Expand Down Expand Up @@ -116,7 +120,4 @@ Or if you are so inclined or use this for commercial work you can

This project was generated with [`wemake-python-package`](https://github.com/wemake-services/wemake-python-package). Current template version is: [326622187bdef4596c6fe0901e481bc6e7ebc93a](https://github.com/wemake-services/wemake-python-package/tree/326622187bdef4596c6fe0901e481bc6e7ebc93a). See what is [updated](https://github.com/wemake-services/wemake-python-package/compare/326622187bdef4596c6fe0901e481bc6e7ebc93a...master) since then.

## References

https://opus.nci.org.au/pages/viewpage.action?pageId=264241166
https://opus.nci.org.au/display/DAE/examples-thredds
14 changes: 7 additions & 7 deletions barra2_dl/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,22 @@ def _find_nearest_point(


def _format_lat_lon(
coordinates: dict,
latitude: float | int,
longitude: float | int,
) -> list[str]:
"""Format a dictionary containing 'lat' and 'lon' as floats to a string with 2 decimal precision,
converting any negative values to 'S'.
Args:
coordinates (dict): Dictionary containing 'lat' and 'lon' as floats.
longitude (float | int):
latitude (float | int):
Returns:
str: Formatted string of the latitude and longitude.
list[str]: Formatted string of the latitude and longitude.
"""
lat = coordinates.get('lat', 0.0)
lon = coordinates.get('lon', 0.0)

formatted_lat = ('S' if lat < 0 else '') + '{:.2f}'.format(abs(lat))
formatted_lon = '{:.2f}'.format(abs(lon))
formatted_lat = ('S' if latitude < 0 else '') + '{:.2f}'.format(abs(latitude))
formatted_lon = '{:.2f}'.format(abs(longitude))

return [formatted_lat, formatted_lon]

0 comments on commit 9bc4a66

Please sign in to comment.