Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 42 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Linux

on:
- push
- pull_request

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- "1"
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Cache artifacts
uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
CMAP_API_KEY: ${{ secrets.CMAP_API_KEY }}
- uses: julia-actions/julia-uploadcodecov@latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/linux_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Linux nightly

on:
- push
- pull_request

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- "nightly"
os:
- ubuntu-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Cache artifacts
uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
CMAP_API_KEY: ${{ secrets.CMAP_API_KEY }}
- uses: julia-actions/julia-uploadcodecov@latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Mac OS X

on:
- push
- pull_request

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- "1"
os:
- macOS-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Cache artifacts
uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
CMAP_API_KEY: ${{ secrets.CMAP_API_KEY }}
- uses: julia-actions/julia-uploadcodecov@latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/mac_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Mac OS X nightly

on:
- push
- pull_request

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- "nightly"
os:
- macOS-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Cache artifacts
uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
CMAP_API_KEY: ${{ secrets.CMAP_API_KEY }}
- uses: julia-actions/julia-uploadcodecov@latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Windows

on:
- push
- pull_request

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- "1"
os:
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Cache artifacts
uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
CMAP_API_KEY: ${{ secrets.CMAP_API_KEY }}
- uses: julia-actions/julia-uploadcodecov@latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/windows_nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Windows nightly

on:
- push
- pull_request

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- "nightly"
os:
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- name: Cache artifacts
uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
env:
CMAP_API_KEY: ${{ secrets.CMAP_API_KEY }}
- uses: julia-actions/julia-uploadcodecov@latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
43 changes: 29 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
![Cover](pic/CMAP.png)

<p>
<a href="https://github.com/simonscmap/CMAP.jl/actions">
<img src="https://img.shields.io/github/workflow/status/simonscmap/CMAP.jl/Mac%20OS%20X?label=OSX&logo=Apple&logoColor=white&style=flat-square">
</a>
<a href="https://github.com/simonscmap/CMAP.jl/actions">
<img src="https://img.shields.io/github/workflow/status/simonscmap/CMAP.jl/Linux?label=Linux&logo=Linux&logoColor=white&style=flat-square">
</a>
<a href="https://github.com/simonscmap/CMAP.jl/actions">
<img src="https://img.shields.io/github/workflow/status/simonscmap/CMAP.jl/Windows?label=Windows&logo=Windows&logoColor=white&style=flat-square">
</a>
<a href="https://codecov.io/gh/simonscmap/CMAP.jl">
<img src="https://img.shields.io/codecov/c/github/simonscmap/CMAP.jl/master?label=Codecov&logo=codecov&logoColor=white&style=flat-square">
</a>
</p>

# cmap.jl

CMAP.jl is the Julia client for Simons CMAP project. It provides access to the Simons CMAP database where various ocean data sets are hosted. These data sets include multi decades of remote sensing observations (satellite), numerical model estimates, and field expeditions.

This package is adopted from [pycmap](https://github.com/simonscmap/pycmap), which is the python client of Simons CMAP ecosystem.
This package is adopted from [pycmap](https://github.com/simonscmap/pycmap), which is the python client of Simons CMAP ecosystem.

## Documentation

Expand All @@ -13,7 +28,7 @@ To be filled out.
## Usage example

1. Set your Simons API key.

To make API requests, you need to get an API key from [Simons CMAP website](https://simonscmap.com). Once you have your API key, run the following command to store the API key on your local machine:

```julia
Expand All @@ -27,20 +42,20 @@ To be filled out.
datasets()
```

1. Retrieve a subset of sea surface temperature measured by satellite.
1. Retrieve a subset of sea surface temperature measured by satellite.

```julia
space_time(
table = "tblArgoMerge_REP",
variable = "argo_merge_salinity_adj",
dt1 = "2015-05-01",
dt2 = "2015-05-30",
lat1 = 28.1,
lat2 = 35.4,
lon1 = -71.3,
lon2 = -50,
depth1 = 0,
table = "tblArgoMerge_REP",
variable = "argo_merge_salinity_adj",
dt1 = "2015-05-01",
dt2 = "2015-05-30",
lat1 = 28.1,
lat2 = 35.4,
lon1 = -71.3,
lon2 = -50,
depth1 = 0,
depth2 = 100
)
)
```

17 changes: 13 additions & 4 deletions src/rest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,19 @@ get_api_key()
"""
function get_api_key()
keyFile = api_key_fname()
if ~isfile(keyFile)
error("API Key file not found. The following command will register the API key:\n\nset_api_key(key::String)\n\n")
end
return DataFrame(CSV.File(keyFile))[1, 1]
if isfile(keyFile)
return DataFrame(CSV.File(keyFile))[1, 1]
elseif haskey(ENV, "CMAP_API_KEY")
return ENV["CMAP_API_KEY"]
else
error("""
API Key file not found. The following command will register the API key:

```
set_api_key("Your API Key here")
```
""")
end
end


Expand Down