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

Replace Formatting with Format #947

Merged
merged 1 commit into from
Dec 12, 2024
Merged

Replace Formatting with Format #947

merged 1 commit into from
Dec 12, 2024

Conversation

imreddyTeja
Copy link
Contributor

@imreddyTeja imreddyTeja commented Dec 10, 2024

Purpose

Formatter.jl is no longer maintained. This PR replaces its usage with Format.jl
Closes #937

To-do

Content


  • I have read and checked the items on the review checklist.

@imreddyTeja imreddyTeja force-pushed the tr/replace-Formatting branch from 4ba901a to 7477f97 Compare December 10, 2024 23:31
@imreddyTeja imreddyTeja force-pushed the tr/replace-Formatting branch from 7477f97 to f71e665 Compare December 10, 2024 23:58
@imreddyTeja imreddyTeja marked this pull request as ready for review December 11, 2024 15:52
Copy link
Member

@juliasloan25 juliasloan25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Teja! I wonder if we even need to keep the Format.jl dependency. It looks like it's only used in one place for met_drivers_FLUXNET.jl and the corresponding lib/ClimaLandSimulations file make_drivers.jl.

Dates.jl also has a function Dates.format that might do what we need. Or if we're only keeping Format around for one function, we could potentially implement it ourselves. Maybe @AlexisRenchon or @Espeer5 will know if we added Format.jl just for the two calls linked above?

@Espeer5
Copy link
Collaborator

Espeer5 commented Dec 11, 2024

Thanks Teja! I wonder if we even need to keep the Format.jl dependency. It looks like it's only used in one place for met_drivers_FLUXNET.jl and the corresponding lib/ClimaLandSimulations file make_drivers.jl.

Dates.jl also has a function Dates.format that might do what we need. Or if we're only keeping Format around for one function, we could potentially implement it ourselves. Maybe @AlexisRenchon or @Espeer5 will know if we added Format.jl just for the two calls linked above?

Hmm it's been a while since I wrote this. I think the problem was that the data would automatically be read in as a number and formatted as "##e##" or something like this... I will make a separate issue to work on this as I also want to generalize these scripts to read a specified start date so that the ClimaArtifact for the fluxtower data can be updated to include the full data sets. In the process I will see if I can remove the dependency on Format.

@juliasloan25
Copy link
Member

Thanks Teja! I wonder if we even need to keep the Format.jl dependency. It looks like it's only used in one place for met_drivers_FLUXNET.jl and the corresponding lib/ClimaLandSimulations file make_drivers.jl.
Dates.jl also has a function Dates.format that might do what we need. Or if we're only keeping Format around for one function, we could potentially implement it ourselves. Maybe @AlexisRenchon or @Espeer5 will know if we added Format.jl just for the two calls linked above?

Hmm it's been a while since I wrote this. I think the problem was that the data would automatically be read in as a number and formatted as "##e##" or something like this... I will make a separate issue to work on this as I also want to generalize these scripts to read a specified start date so that the ClimaArtifact for the fluxtower data can be updated to include the full data sets. In the process I will see if I can remove the dependency on Format.

That sounds like a good plan! In the meantime, we can go ahead with this PR to at least remove the docs warning about Formatting.jl

@imreddyTeja
Copy link
Contributor Author

Hmm it's been a while since I wrote this. I think the problem was that the data would automatically be read in as a number and formatted as "##e##" or something like this... I will make a separate issue to work on this as I also want to generalize these scripts to read a specified start date so that the ClimaArtifact for the fluxtower data can be updated to include the full data sets. In the process I will see if I can remove the dependency on Format.

I briefly looked into it when replacing Formatting with Format. It seems like format is used because to parse something in the yyyymmddHHMM form, Dates needs a string. The string representation of large floats in is scientific notation. I think we could get around this by converting the dates that are read in to ints before converting them to strings.

For example:

DateTime.(format.(driver_data[2:end, 1]), "yyyymmddHHMM")

could be

DateTime.(string.(Int.(driver_data[2:end, 1])), "yyyymmddHHMM")

This should be fine because the original would still error if a non-whole number is given.

@imreddyTeja imreddyTeja merged commit e2c9c62 into main Dec 12, 2024
16 checks passed
@imreddyTeja imreddyTeja deleted the tr/replace-Formatting branch December 12, 2024 16:51
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.

replace Formatting.jl with Format.jl
3 participants