-
Notifications
You must be signed in to change notification settings - Fork 145
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
Compressed state option for MITgcm_ocean NBLING #455
Closed
Closed
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
d67b475
Initial commit of the adaptive close_state_caching
874cf22
Comment out the close_state_cach = .false. in get_close_state_cached
0428283
Add do_output for the print statements
774b9cc
New I/O scheme with offline processing of large input state
5a8b812
Merge branch 'main' into netcdf-reduce
hkershaw-brown 7d5867f
moved dart_nc_reduce one directory up to compile
hkershaw-brown d376f80
grid size is harded coded - change to small case
hkershaw-brown 869d89d
using dart netcdf utilites and types modules
hkershaw-brown fbbb201
mirror of dart_nc_reduce. untested.
hkershaw-brown b14007d
ZC is double - check dart_nc_reduce
hkershaw-brown d9e2979
zc double dart_nc_expand
hkershaw-brown d197e63
netcdf and model_mod_check for comparision with main
hkershaw-brown e9273c8
Merge branch 'main' into netcdf-reduce
hkershaw-brown a409ff4
function for defining variables mit2dart
hkershaw-brown 3d0c053
function for dart to mit. untested.
hkershaw-brown e007252
bug-fix: returns need to be inside if statement
hkershaw-brown fba76b4
bitwise mit_to_dart non-compressed with main, log and nolog
hkershaw-brown 951235c
bitwise with main dart_to_mit, no compression
hkershaw-brown 60c742c
size of compressed variables
hkershaw-brown 8b556ba
partway through compressed write, I think separate writes for 2d vs
hkershaw-brown b239419
write compressed. untested. missing coord
hkershaw-brown 1a7bf39
note on delX,Y - does delX,Y vary?
hkershaw-brown d4c3905
record indices for X,Y,Z
hkershaw-brown 39568db
compressing out vals=0.0
hkershaw-brown 329cd42
replace hardcoded 0.0_r8 with binary_fill variable
hkershaw-brown 6fbbdf0
somthing funky with ETA
hkershaw-brown a7d60db
bug-fix: 2D ETA variable is th k=1 slice
hkershaw-brown 0c2c781
revert assim_tools_mod to main
hkershaw-brown 80e22dc
move initializing to fill outside read_compressed
hkershaw-brown 0a30429
Merge branch 'main' into netcdf-reduce
hkershaw-brown 3d1746f
bug fix: was not setting binary fill correctly for 2d
hkershaw-brown 5709e68
Merge branch 'main' into netcdf-reduce
hkershaw-brown 9951fd8
removed dart_nc_reduce/expand as these functions are now part of mit_…
hkershaw-brown 720f763
revert mpas input.nml to main
hkershaw-brown b2b218d
remove whitespace only differences
hkershaw-brown 1e7e186
get_state_meta data and get_val
hkershaw-brown 25769ca
compressed lon,lat is r4. compressed depth r8
hkershaw-brown 3e92f58
note on perturbing compressed vs non-compressed state
hkershaw-brown 43e74ca
bug-fix: masked initialized to false for compresed and not compressed
hkershaw-brown e641695
style: switch tabs for spaces
hkershaw-brown 32df048
2d and staggered variables are incorrect
hkershaw-brown 12fa6c0
Merge branch 'main' into netcdf-reduce
hkershaw-brown 8dcb481
fix: depth dimension first in compression so 2d index search is correct
hkershaw-brown 03564a4
program to expand compressed netcdf to full X,Y,Z
hkershaw-brown 63c19b5
recl2d and recl3d set in static_init_trans
hkershaw-brown d54cbfb
doc: compressed netcdf files
fnrliu e926fe0
Merge branch 'main' into netcdf-reduce
hkershaw-brown cd107d1
Option to output CHL for dart_to_mit
hkershaw-brown 2c0b275
Merge branch 'main' into netcdf-reduce
hkershaw-brown 5fe6781
Merge branch 'main' into netcdf-reduce
hkershaw-brown 630b5a1
Merge branch 'main' into netcdf-reduce
hkershaw-brown d048a05
one place to set recl3d recl2d
hkershaw-brown 134570b
Merge branch 'main' into netcdf-reduce
hkershaw-brown f0da199
Merge branch 'main' into netcdf-reduce
hkershaw-brown de015c6
Merge branch 'main' into netcdf-reduce
hkershaw-brown a2c0d26
Merge branch 'main' into netcdf-reduce
hkershaw-brown 41b35e3
Merge branch 'main' into netcdf-reduce
hkershaw-brown 92142d8
Merge branch 'main' into netcdf-reduce
hkershaw-brown e0dd62b
Merge branch 'main' into netcdf-reduce
hkershaw-brown e5ce225
Merge branch 'main' into netcdf-reduce
hkershaw-brown 96770ad
Merge branch 'main' into netcdf-reduce
hkershaw-brown 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
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,149 @@ | ||
! Uncompress a netcdf fil | ||
program expand_netcdf | ||
|
||
use netcdf_utilities_mod, only: nc_open_file_readonly, nc_get_dimension_size, & | ||
nc_define_dimension, nc_create_file, & | ||
nc_get_variable, nc_close_file, nc_put_variable, & | ||
nc_define_real_variable, nc_end_define_mode, & | ||
nc_add_attribute_to_variable | ||
|
||
use types_mod, only : r4, MISSING_R4 | ||
|
||
use utilities_mod, only : initialize_utilities, finalize_utilities | ||
|
||
use netcdf | ||
|
||
implicit none | ||
|
||
integer :: ncid, ncid_comp, dimid(1), dimlen, ret | ||
integer :: Nx,Ny,Nz | ||
integer :: nvars ! total number of variables in compressed file | ||
integer :: id, n, c! loop variables | ||
integer :: i,j,k, ncomp3d, ncomp2d | ||
character(len=NF90_MAX_NAME) :: varname | ||
real(r4), allocatable :: vals3d(:,:,:), vals2d(:,:), vals_comp(:) | ||
integer, allocatable :: Xcomp_ind(:), Ycomp_ind(:), Zcomp_ind(:) | ||
|
||
call initialize_utilities('expand_netcdf') | ||
|
||
ncid_comp = nc_open_file_readonly('compressed.nc') | ||
ncid = nc_create_file('expanded.nc') | ||
|
||
! get the Nx,Ny,Nz | ||
Nx = nc_get_dimension_size(ncid_comp, 'XC') | ||
Ny = nc_get_dimension_size(ncid_comp, 'YC') | ||
Nz = nc_get_dimension_size(ncid_comp, 'ZC') | ||
|
||
! define Nx,Ny,Nz in the expanded file | ||
call nc_define_dimension(ncid, 'X', Nx) | ||
call nc_define_dimension(ncid, 'Y', Ny) | ||
call nc_define_dimension(ncid, 'Z', Nz) | ||
|
||
! get the compressed size | ||
ncomp2d = nc_get_dimension_size(ncid_comp, 'comp2d') | ||
ncomp3d = nc_get_dimension_size(ncid_comp, 'comp3d') | ||
|
||
allocate(vals_comp(ncomp3d)) | ||
allocate(vals2d(Nx,Ny), vals3d(Nx,Ny,Nz)) | ||
|
||
! read in | ||
allocate(Xcomp_ind(ncomp3d), Ycomp_ind(ncomp3d), Zcomp_ind(ncomp3d)) | ||
call nc_get_variable(ncid_comp, 'Ycomp_ind', Ycomp_ind) | ||
call nc_get_variable(ncid_comp, 'Xcomp_ind', Xcomp_ind) | ||
call nc_get_variable(ncid_comp, 'Zcomp_ind', Zcomp_ind) | ||
|
||
|
||
! get the number of variables | ||
ret = nf90_inquire(ncid_comp, nVariables=nvars) | ||
|
||
! define variables | ||
do id = 1, nvars | ||
ret = nf90_inquire_variable(ncid_comp, id, varname, dimids=dimid) | ||
|
||
! is a it a compressed state variable? | ||
if (var_of_interest(varname)) then | ||
|
||
! inquire dimention length (2d or 3d) | ||
ret = nf90_inquire_dimension(ncid_comp, dimid(1), len=dimlen) | ||
|
||
! define expanded variable | ||
if (dimlen == ncomp3d) then | ||
call nc_define_real_variable(ncid, varname, (/'X','Y','Z'/)) | ||
else | ||
call nc_define_real_variable(ncid, varname, (/'X','Y'/)) | ||
endif | ||
|
||
call nc_add_attribute_to_variable(ncid, varname, 'missing_value', MISSING_R4) | ||
|
||
endif | ||
enddo | ||
|
||
call nc_end_define_mode(ncid) | ||
|
||
! write variables | ||
do id = 1, nvars | ||
ret = nf90_inquire_variable(ncid_comp, id, varname, dimids=dimid) | ||
|
||
! is a it a compressed state variable? | ||
if (var_of_interest(varname)) then | ||
|
||
! inquire dimention length (2d or 3d) | ||
ret = nf90_inquire_dimension(ncid_comp, dimid(1), len=dimlen) | ||
|
||
! read in compressed variable | ||
if (dimlen == ncomp3d) then | ||
call nc_get_variable(ncid_comp, varname, vals_comp) | ||
vals3d = MISSING_R4 | ||
else | ||
call nc_get_variable(ncid_comp, varname, vals_comp(1:ncomp2d)) | ||
vals2d = MISSING_R4 | ||
endif | ||
|
||
! expand | ||
c = 1 | ||
do n = 1, ncomp3d | ||
i = Xcomp_ind(n) | ||
j = Ycomp_ind(n) | ||
k = Zcomp_ind(n) | ||
if (k == 1 .and. dimlen == ncomp2d) then | ||
vals2d(i,j) = vals_comp(c) | ||
c = c + 1 | ||
else | ||
vals3d(i,j,k) = vals_comp(n) | ||
endif | ||
enddo | ||
|
||
! write expanded variable | ||
if (dimlen == ncomp3d) then | ||
call nc_put_variable(ncid, varname, vals3d) | ||
else | ||
call nc_put_variable(ncid, varname, vals2d) | ||
endif | ||
|
||
endif | ||
enddo | ||
|
||
call nc_close_file(ncid_comp) | ||
call nc_close_file(ncid) | ||
|
||
call finalize_utilities('expand_netcdf') | ||
|
||
contains | ||
|
||
! logical to ignore compression variables | ||
function var_of_interest(varname) | ||
character(len=*), intent(in) :: varname | ||
logical :: var_of_interest | ||
|
||
select case (varname) | ||
case ('XGcomp', 'XCcomp', 'YGcomp', 'YCcomp', 'ZCcomp', 'Xcomp_ind', 'Ycomp_ind', 'Zcomp_ind') | ||
var_of_interest = .false. | ||
case ('XC', 'YC', 'ZC', 'XG', 'YG') | ||
var_of_interest = .false. | ||
case default | ||
var_of_interest = .true. | ||
end select | ||
|
||
end function var_of_interest | ||
|
||
end program expand_netcdf |
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.
Helen you probably don't want to leave this in, see #287 for netcdf notes
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 believe we need to leave this in if we want to be able to create DART files in the netCDF-4 format (with unlimited time dim), else it will throw the error message shown in #287.
But I'm not sure if including NF90_64BIT_OFFSET as an ior argument will cause DART files that are not in the netCDF-4 format to be created with incorrect formatting?