-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1566 from OceanParcels/fieldset_from_directory
Creating a new `Fieldset.from_modulefile()` method
- Loading branch information
Showing
4 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from os import path | ||
|
||
import parcels | ||
|
||
|
||
def create_fieldset(indices=None): | ||
data_path = path.join(path.dirname(__file__)) | ||
|
||
filenames = {'U': {'lon': path.join(data_path, 'mask_nemo_cross_180lon.nc'), | ||
'lat': path.join(data_path, 'mask_nemo_cross_180lon.nc'), | ||
'data': path.join(data_path, 'Uu_eastward_nemo_cross_180lon.nc')}, | ||
'V': {'lon': path.join(data_path, 'mask_nemo_cross_180lon.nc'), | ||
'lat': path.join(data_path, 'mask_nemo_cross_180lon.nc'), | ||
'data': path.join(data_path, 'Vv_eastward_nemo_cross_180lon.nc')}} | ||
variables = {'U': 'U', 'V': 'V'} | ||
dimensions = {'lon': 'glamf', 'lat': 'gphif', 'time': 'time_counter'} | ||
indices = indices or {} | ||
return parcels.FieldSet.from_nemo(filenames, variables, dimensions, indices=indices) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from os import path | ||
|
||
import parcels | ||
|
||
|
||
def random_function_name(): | ||
data_path = path.join(path.dirname(__file__)) | ||
|
||
filenames = {'U': {'lon': path.join(data_path, 'mask_nemo_cross_180lon.nc'), | ||
'lat': path.join(data_path, 'mask_nemo_cross_180lon.nc'), | ||
'data': path.join(data_path, 'Uu_eastward_nemo_cross_180lon.nc')}, | ||
'V': {'lon': path.join(data_path, 'mask_nemo_cross_180lon.nc'), | ||
'lat': path.join(data_path, 'mask_nemo_cross_180lon.nc'), | ||
'data': path.join(data_path, 'Vv_eastward_nemo_cross_180lon.nc')}} | ||
variables = {'U': 'U', 'V': 'V'} | ||
dimensions = {'lon': 'glamf', 'lat': 'gphif', 'time': 'time_counter'} | ||
return parcels.FieldSet.from_nemo(filenames, variables, dimensions) | ||
|
||
|
||
def none_returning_function(): | ||
return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters