-
Notifications
You must be signed in to change notification settings - Fork 12
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
Enable starting driver from Fortran restart files for TC case #339
Merged
Merged
Changes from all commits
Commits
Show all changes
145 commits
Select commit
Hold shift + click to select a range
056d0ec
initial commit
efc69b5
first attempt at functions to restart from Fortran
c0e933a
added code in _restart_driver_state to call _overwrite_state_from_for…
c819291
fixed state traversal
c92702d
Merge branch 'main' into feature/fortran_restart
ajdas1 a01292c
restartconfig now runs, but model crashes after
ajdas1 6c56f28
lots of print statements
ajdas1 4e53988
removed print statements - mostly
ajdas1 d40d8bc
modifying properties
ajdas1 10677b1
small changes
ajdas1 8970f5d
updated properties
ajdas1 72c326d
updated RESTART_PROPERTIES
ajdas1 00ba2c8
updated gt4py, buildenv
ajdas1 0dfeec5
Merge branch 'main' into feature/fortran_restart
ajdas1 6b2ada9
renamed pace physics
ajdas1 5f1a1c2
pre-commit
ajdas1 309ed12
writing test for restart
ajdas1 19f72f3
check only dycore, tests
ajdas1 2d0f4e6
modified properties
ajdas1 14c3949
begin generating grid from metric terms
ajdas1 1b83fcf
git pull on main
ajdas1 4ba9d75
Merge branch 'main' of github.com:ai2cm/pace into main
ajdas1 de74a75
add from_lat_lon method to MetricTerms
ajdas1 5b04203
metric_terms look good
ajdas1 ab93000
testing metric terms
ajdas1 46f9121
gitignore
ajdas1 9dcaa88
Merge branch 'feature/metric_terms_from_lat_lon' into feature/fortran…
ajdas1 14b88d2
next step
ajdas1 5e041ce
Merge branch 'main' of github.com:ai2cm/pace into main
ajdas1 02f4df6
added grid transformation - Schmidt
ajdas1 dd7a506
updated history
ajdas1 e4fdc6f
lint
ajdas1 0f24cc2
testing ak, bk
ajdas1 1e8d3fc
gitignore removed nc, png
ajdas1 9f665f1
added grid config to driver
ajdas1 82ebb87
pre-commit
ajdas1 eb04446
changed default to None
ajdas1 37dad82
added grid_config to test_driver.
ajdas1 9556fde
Merge branch 'feature/transform_grid_stretch' into feature/fortran_re…
ajdas1 6c22105
this doesn't work
ajdas1 a249176
reads tc restart - no grid transform
ajdas1 9035ef7
small changes
ajdas1 363c8d9
stretched grid testing
ajdas1 a213310
next steps
ajdas1 c1f2399
moved offset factor to function
ajdas1 a06d54a
consolidate driver functions
ajdas1 bd47c32
config
ajdas1 9deebf8
main gitignore
ajdas1 b5fb50d
Merge branch 'main' of github.com:ai2cm/pace into main
ajdas1 0b75412
update
ajdas1 979c6db
fix origin and extent on lon/lat variables in MetricTerms
mcgibbon 5baa256
test
ajdas1 26edfdb
Merge branch 'main' into feature/fortran_restart
ajdas1 16f9522
empty
ajdas1 ed960ed
Merge branch 'main' of github.com:ai2cm/pace into main
ajdas1 a3db0d1
Merge branch 'main' into feature/fortran_restart
ajdas1 efec08d
second try
ajdas1 69fc91b
Fix/restart gpu backend (#329)
elynnwu c522001
typing
ajdas1 17969b4
cleaned up
ajdas1 9ba8df9
pre-commit
ajdas1 d1837b8
removed some notebooks
ajdas1 b34ef47
Update .gitignore
ajdas1 891499d
updated path to google bucket with restart files
ajdas1 a3cfd72
updated stretch_transform with np, removed sign
ajdas1 930ff38
exchanged numpy_module for np
ajdas1 b7fd11c
updated type hints on stretch_transform
ajdas1 9f78ebe
added np to doc string
ajdas1 448ac5f
removed empty lines from _legacy_restart
ajdas1 124d0b6
removed stretch_grid from fv3core config
ajdas1 90a084f
added fortran restart config
ajdas1 5005442
restart_driver_state determines if fortran or not
ajdas1 7a8b6a1
started working on GridInitializer for generated
ajdas1 5815689
in driver, separate grid and restart in, beginning
ajdas1 828ba1a
self.config.grid?
ajdas1 03741a5
get grid init separate from driver state init
ajdas1 abb5e7c
removed ptop from vertical grid data
ajdas1 3fd723f
removing fortran_restart flag
ajdas1 c4dc55d
RESTART_PROPERTIES reverted, added to driver
ajdas1 c04afc2
undid google cloud bucket path
ajdas1 bc2a4b0
making legacy_restart work ...
ajdas1 4b717b3
pre-commit
ajdas1 e39949c
another pre-commit
ajdas1 e497736
changed namelist to not dycore only
ajdas1 e8386ad
gitignore
ajdas1 75bbd63
Merge branch 'feature/fortran_restart' of github.com:ai2cm/pace into …
ajdas1 bd072bb
allows to download data from google bucket
ajdas1 00d94a9
grid_init changed to grid_config
ajdas1 288ac4b
grid config
ajdas1 dd37763
docstrings
ajdas1 06a3acd
refactor grid functions to take in more arguments
ajdas1 fbc55cd
hardcode default stretch_factor, lon, lat target
ajdas1 2f41457
serialized_grid boolean removed
ajdas1 7369b1d
more vertical grid data changes
ajdas1 2005ed5
removed gridconfig
ajdas1 9ba0515
docstring for update fortran restart pe_peln
ajdas1 db8e1d9
update for different np
ajdas1 ba3df72
renoved return statement from dict_state_to_driver
ajdas1 2f9fc6c
removed return for metric terms
ajdas1 d093513
removed some return statements
ajdas1 9e8a2b2
cool new syntax if file has string
ajdas1 b3bd8ab
for more than 6 ranks, scatter state
ajdas1 0185824
minor
ajdas1 288ac16
moved fortran restart from state to initialization
ajdas1 ba955b4
tracer properties
ajdas1 7b53ff9
refactor baroclinic_init to take in grid data
ajdas1 18a3501
pre-commit
ajdas1 73c96c7
moved fortran stuff back to state
ajdas1 ae3b759
gitignore
ajdas1 3533cfb
pace util tests for test_legacy_restart
ajdas1 37682e0
tests and baroclinic restart work
ajdas1 0b012a7
baroclinic init change from metric terms
ajdas1 512032a
fix fortran restart initialization
mcgibbon e32b304
Merge branch 'main' into feature/fortran_restart
mcgibbon bb6b9ad
fix driver tests, convert fv3core grid dataclasses to use Quantity
mcgibbon 73d49d8
fix remaining main tests
mcgibbon 84102f2
fix some translate tests
mcgibbon ff3a7c1
fixes from read-through of code
mcgibbon 707f363
small fixes to driver to use quantity in grid data
mcgibbon f6431ba
start fixing translate tests by updating grid to use quantity (broken…
mcgibbon 8498aed
Merge branch 'main' into feature/fortran_restart
mcgibbon a136e16
Merge branch 'main' into fix/grid_origins
mcgibbon 8b1ecba
add workaround for grid still using storage in translate tests
mcgibbon cd0b401
start fixing tests
mcgibbon c0e59e8
Merge branch 'main' into fix/grid_origins
mcgibbon f7fb0da
Merge branch 'fix/grid_origins' into feature/fortran_restart
mcgibbon 892f358
fix restart mpi test
mcgibbon 4394baa
fix driver main test
mcgibbon 52cece8
fix grid init 54rank test
mcgibbon c258dd5
add cpu orchestration main test
mcgibbon 4d9758c
attempt to fix dace_gpu failure on jenkins
mcgibbon 63d973e
Merge branch 'main' into feature/fortran_restart
mcgibbon b7ddb85
update test_main circleci plan to use gt4py caching
mcgibbon 7c34196
write version of split_quantity for storages
mcgibbon f3e06eb
fix config validation
mcgibbon 0862dd1
Merge branch 'main' into feature/fortran_restart
mcgibbon 8bee945
better fix for memoryview type error
mcgibbon 58cf5dd
add gcloud_encoded_key context to test_main
mcgibbon 38f5269
Update driver/pace/driver/initialization.py
mcgibbon 4b72f99
response to review comments
mcgibbon 42e6b66
use smaller data for test_main
mcgibbon 7bede1c
Merge branch 'feature/fortran_restart' of github.com:ai2cm/pace into …
mcgibbon 5a17b70
Merge branch 'main' into feature/fortran_restart
mcgibbon 9ec891e
remove system-dependent non-working test
mcgibbon 07b0240
update pace-util HISTORY
mcgibbon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -162,3 +162,5 @@ RESTART/ | |
_dacegraphs | ||
|
||
**/testing/output/* | ||
*.png | ||
*.nc | ||
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
93 changes: 93 additions & 0 deletions
93
driver/examples/configs/baroclinic_c12_read_restart_fortran.yml
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,93 @@ | ||
stencil_config: | ||
compilation_config: | ||
backend: numpy | ||
rebuild: false | ||
validate_args: true | ||
format_source: false | ||
device_sync: false | ||
initialization: | ||
config: | ||
path: /home/ajdas/pace/restart_data/1.0 | ||
type: fortran_restart | ||
performance_config: | ||
performance_mode: true | ||
experiment_name: c12_baroclinic_restart | ||
grid_config: | ||
type: generated | ||
nx_tile: 12 | ||
nz: 79 | ||
dt_atmos: 225 | ||
minutes: 15 | ||
layout: | ||
- 1 | ||
- 1 | ||
diagnostics_config: | ||
path: "output.zarr" | ||
names: | ||
- u | ||
- v | ||
- ua | ||
- va | ||
- pt | ||
- delp | ||
- qvapor | ||
- qliquid | ||
- qice | ||
- qrain | ||
- qsnow | ||
- qgraupel | ||
dycore_config: | ||
a_imp: 1.0 | ||
beta: 0. | ||
consv_te: 0. | ||
d2_bg: 0. | ||
d2_bg_k1: 0.2 | ||
d2_bg_k2: 0.1 | ||
d4_bg: 0.15 | ||
d_con: 1.0 | ||
d_ext: 0.0 | ||
dddmp: 0.5 | ||
delt_max: 0.002 | ||
do_sat_adj: true | ||
do_vort_damp: true | ||
fill: true | ||
hord_dp: 6 | ||
hord_mt: 6 | ||
hord_tm: 6 | ||
hord_tr: 8 | ||
hord_vt: 6 | ||
hydrostatic: false | ||
k_split: 1 | ||
ke_bg: 0. | ||
kord_mt: 9 | ||
kord_tm: -9 | ||
kord_tr: 9 | ||
kord_wz: 9 | ||
n_split: 1 | ||
nord: 3 | ||
nwat: 6 | ||
p_fac: 0.05 | ||
rf_cutoff: 3000. | ||
rf_fast: true | ||
tau: 10. | ||
vtdm4: 0.06 | ||
z_tracer: true | ||
do_qa: true | ||
tau_i2s: 1000. | ||
tau_g2v: 1200. | ||
ql_gen: 0.001 | ||
ql_mlt: 0.002 | ||
qs_mlt: 0.000001 | ||
qi_lim: 1.0 | ||
dw_ocean: 0.1 | ||
dw_land: 0.15 | ||
icloud_f: 0 | ||
tau_l2v: 300. | ||
tau_v2l: 90. | ||
fv_sg_adj: 0 | ||
n_sponge: 48 | ||
|
||
physics_config: | ||
hydrostatic: false | ||
nwat: 6 | ||
do_qa: true |
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,98 @@ | ||
dycore_only: true | ||
disable_step_physics: true | ||
stencil_config: | ||
compilation_config: | ||
backend: numpy | ||
rebuild: false | ||
validate_args: true | ||
format_source: false | ||
device_sync: false | ||
initialization: | ||
config: | ||
path: gs://vcm-ml-public/dsl/initial_conditions/c128_6ranks_tc | ||
type: fortran_restart | ||
grid_config: | ||
config: | ||
stretch_factor: 3.0 | ||
lon_target: 172.5 | ||
lat_target: 17.5 | ||
ks: 0 | ||
vertical_grid_from_restart: True | ||
type: generated | ||
performance_config: | ||
performance_mode: true | ||
experiment_name: c128_tropical | ||
nx_tile: 128 | ||
nz: 79 | ||
dt_atmos: 60 | ||
minutes: 20 | ||
layout: | ||
- 1 | ||
- 1 | ||
diagnostics_config: | ||
path: "output.zarr" | ||
names: | ||
- u | ||
- v | ||
- ua | ||
- va | ||
- pt | ||
- delp | ||
- qvapor | ||
output_initial_state: true | ||
dycore_config: | ||
a_imp: 1.0 | ||
beta: 0. | ||
consv_te: 0. | ||
d2_bg: 0. | ||
d2_bg_k1: 0.2 | ||
d2_bg_k2: 0.15 | ||
d4_bg: 0.14 | ||
d_con: 1.0 | ||
d_ext: 0.0 | ||
dddmp: 0.5 | ||
delt_max: 0.002 | ||
do_sat_adj: false | ||
do_vort_damp: true | ||
fill: false | ||
hord_dp: 6 | ||
hord_mt: 6 | ||
hord_tm: 6 | ||
hord_tr: 8 | ||
hord_vt: 6 | ||
hydrostatic: false | ||
k_split: 2 | ||
ke_bg: 0. | ||
kord_mt: 9 | ||
kord_tm: -9 | ||
kord_tr: 9 | ||
kord_wz: 9 | ||
n_split: 3 | ||
nord: 3 | ||
nwat: 6 | ||
p_fac: 0.1 | ||
rf_cutoff: 5000. | ||
rf_fast: true | ||
tau: 5. | ||
vtdm4: 0.06 | ||
z_tracer: true | ||
do_qa: true | ||
tau_i2s: 1000. | ||
tau_g2v: 900. | ||
ql_gen: 0.001 | ||
ql_mlt: 0.001 | ||
qs_mlt: 0.000001 | ||
qi_lim: 1.0 | ||
dw_ocean: 0.1 | ||
dw_land: 0.16 | ||
icloud_f: 0 | ||
tau_l2v: 225. | ||
tau_v2l: 150. | ||
fv_sg_adj: 600 | ||
n_sponge: 48 | ||
p_ref: 101500. | ||
|
||
physics_config: | ||
hydrostatic: false | ||
nwat: 6 | ||
do_qa: true |
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 |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
import pace.util | ||
import pace.util.grid | ||
from pace.dsl.dace.orchestration import dace_inhibitor | ||
from pace.util.quantity import QuantityMetadata | ||
|
||
from .state import DriverState | ||
|
||
|
@@ -27,9 +26,7 @@ def store(self, time: Union[datetime, timedelta], state: DriverState): | |
... | ||
|
||
@abc.abstractmethod | ||
def store_grid( | ||
self, grid_data: pace.util.grid.GridData, metadata: QuantityMetadata | ||
): | ||
def store_grid(self, grid_data: pace.util.grid.GridData): | ||
... | ||
|
||
|
||
|
@@ -133,19 +130,11 @@ def _get_derived_state(self, state: DriverState): | |
warnings.warn(f"{name} is not a supported diagnostic variable.") | ||
return output | ||
|
||
def store_grid( | ||
self, grid_data: pace.util.grid.GridData, metadata: QuantityMetadata | ||
): | ||
zarr_grid = {} | ||
for name in ["lat", "lon"]: | ||
grid_quantity = pace.util.Quantity( | ||
getattr(grid_data, name), | ||
dims=("x_interface", "y_interface"), | ||
origin=metadata.origin, | ||
extent=(metadata.extent[0] + 1, metadata.extent[1] + 1), | ||
units="rad", | ||
) | ||
zarr_grid[name] = grid_quantity | ||
def store_grid(self, grid_data: pace.util.grid.GridData): | ||
zarr_grid = { | ||
"lat": grid_data.lat, | ||
"lon": grid_data.lon, | ||
Comment on lines
+135
to
+136
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👏 |
||
} | ||
self.monitor.store_constant(zarr_grid) | ||
|
||
|
||
|
@@ -155,9 +144,7 @@ class NullDiagnostics(Diagnostics): | |
def store(self, time: Union[datetime, timedelta], state: DriverState): | ||
pass | ||
|
||
def store_grid( | ||
self, grid_data: pace.util.grid.GridData, metadata: QuantityMetadata | ||
): | ||
def store_grid(self, grid_data: pace.util.grid.GridData): | ||
pass | ||
|
||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually want to ignore all png and nc files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically no, I think we do have one of each committed into the repo that should be there. But adding to the gitignore doesn't prevent from adding files manually, and our scripts produce a fair bit of these that we don't want to commit. I could go either way but I'd lean towards having this in the gitignore, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with leaving it like this, just wanted to be careful when we do actually want to commit a png/nc file.