Skip to content
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

add "_Encoding" attribute to time_iso history file variable #515

Closed
wants to merge 4 commits into from

Conversation

jswhit
Copy link
Contributor

@jswhit jswhit commented Mar 29, 2022

The 'time_iso' variable is an array of characters. The "_Encoding" attribute allows netcdf clients (like python) to automatically convert the array of characters to a fixed-length string (see Unidata/netcdf4-python#654 (comment)).

Before this patch,

>>> nc = Dataset('test.nc')
>>> nc['time_iso'][:]
masked_array(data=[[b'2', b'0', b'2', b'1', b'-', b'0', b'8', b'-', b'3',
                    b'0', b'T', b'0', b'0', b':', b'0', b'0', b':', b'0',
                    b'0', b'Z']],
             mask=False,
       fill_value=b'N/A',
            dtype='|S1')
>>> 

After this patch,

>>> nc['time_iso'][:]
array(['2016-01-04T06:00:00Z'], dtype='<U20')
>>>

See also Unidata/netcdf-c#402

Since this patch is tiny it might make sense to merge it into another larger update.

@junwang-noaa
Copy link
Collaborator

@jswhit Will this code update change results?

@jswhit
Copy link
Contributor Author

jswhit commented Mar 30, 2022

@junwang-noaa no it will not change results - it just adds another attribute to the time_iso variable.

SamuelTrahanNOAA pushed a commit to SamuelTrahanNOAA/fv3atm that referenced this pull request Jun 13, 2022
* Updates to RRTMGP in FV3/CCPP. New RT for regional configuration using RRTMGP
* Updated submodule to my forked repo.
* Changed default namelist setting for RRTMGP.
* Turned on feature to use GP LW flux-adjustment.
* Removed mistake in previous commit
* Updates to RRTMGP RTs.
* Updated RT nml.
* Updated GP regional RTs
* Reverted deprecated code in FV3/ccpp-physics.
* Removed GP c192L127 RT
* Commented out RRTMGP c192l127 RT in rt.conf.
* GP_2thread RT working.
* Updated FV3/physics
* Revert "GP_2thread RT working."
Co-authored-by: Dom Heinzeller <[email protected]>
@DusanJovic-NOAA
Copy link
Collaborator

Merged via #550

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants