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

Reading metadata information to google buckets #9092

Closed

Conversation

Vitalis95
Copy link
Contributor

Fixes #9075
@lilyclements @jkmusyoka , have a look at it

@jkmusyoka
Copy link
Contributor

@Vitalis95 thanks for the first go at this. I have two comments

  1. The name of the dialog is misleading. It should be "Export to Google Buckets" not "Export Climatic Definitions"
  2. I would like to suggest a redesign of the dialog so that it is consistent with other dialogs with a similar structure. This suggestion will make it possible to update the metadata without "being forced" to export summaries as well. For the revised dialog, main dialog should have two tabs at the top namely Update Metadata and Upload Summaries. The Token receiver can follow below these tabs and should be given once for both tabs. What follows after the token receiver will depend on the selected tab at the top of the dialog. See the new import from climsoft dialog below whose design is consistent with what I am suggesting. It might help to understand this point.
    image
    image

@Vitalis95
Copy link
Contributor Author

@jkmusyoka , have made the changes. Do we need Token in both buttons or only in the Upload Summaries ?
This is the code being run with Tokens
epicsawrap::gcs_auth_file(filename="C:/Users/User/Downloads/epicsa_token.json")

@rdstern
Copy link
Collaborator

rdstern commented Aug 2, 2024

@Vitalis95 just to follow the same as in Patrick's Import from Climsoft.
The Token should be in both, but it is linked, so the user can input it in either, and it is then registered in both. I hope that's clear?

@jkmusyoka
Copy link
Contributor

@Vitalis95 the update metadata dialog also needs a country receiver. This is currently missing and so it is not possible to specify which folder in the google buckets we are updating with this info. Each country has its own folder.

@Vitalis95
Copy link
Contributor Author

@jkmusyoka , I have added the country argument

@Vitalis95
Copy link
Contributor Author

@jkmusyoka , over to you. I have tested from my end its fine

@jkmusyoka
Copy link
Contributor

@Vitalis95 the update metadata part of the dialog works fine now.

However the other part Upload summaries has regressed and returns the following error. Could you look into this?
image

@Vitalis95
Copy link
Contributor Author

@jkmusyoka , on the Summaries, you have checked both Annual Rain and Annual Temperature, so when you check Include Summary Data checkbox then on the sub dialog you should also have for Annual Rain and Annual Temperature . You only have for Annual Rain.

@jkmusyoka
Copy link
Contributor

@Vitalis95 well spotted. That was my fault.

The dialog is all done now, thanks for the hard work.

I ll do some final testing tomorrow and if all goes well, I ll approve so the changes are merged.

Thanks

Copy link
Contributor

@jkmusyoka jkmusyoka left a comment

Choose a reason for hiding this comment

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

@N-thony this is now ready for merging with master. Over to you.

Thanks @Vitalis95 and @lilyclements

Comment on lines +23 to +81
Private Sub sdgMetadataGoogleBuckets_Load(sender As Object, e As EventArgs) Handles MyBase.Load
autoTranslate(Me)
End Sub
Public Sub InitialiseControls()
ucrSelectorMetadata.SetParameter(New RParameter("metadata_data", 0))
ucrSelectorMetadata.SetParameterIsrfunction()

ucrReceiverStation.SetParameter(New RParameter("station_var", 1))
ucrReceiverStation.Selector = ucrSelectorMetadata
ucrReceiverStation.SetParameterIsString()
ucrReceiverStation.SetClimaticType("station")
ucrReceiverStation.bAutoFill = True

ucrReceiverLongititude.SetParameter(New RParameter("longitude_var", 2))
ucrReceiverLongititude.Selector = ucrSelectorMetadata
ucrReceiverLongititude.SetParameterIsString()
ucrReceiverLongititude.SetClimaticType("lon")
ucrReceiverLongititude.bAutoFill = True

ucrReceiverLatitude.SetParameter(New RParameter("latitude_var", 3))
ucrReceiverLatitude.Selector = ucrSelectorMetadata
ucrReceiverLatitude.SetParameterIsString()
ucrReceiverLatitude.SetClimaticType("lat")
ucrReceiverLatitude.bAutoFill = True

ucrReceiverElavation.SetParameter(New RParameter("elevation_var", 4))
ucrReceiverElavation.Selector = ucrSelectorMetadata
ucrReceiverElavation.SetParameterIsString()
ucrReceiverElavation.SetClimaticType("alt")
ucrReceiverElavation.bAutoFill = True

ucrReceiverDistrict.SetParameter(New RParameter("district_var", 5))
ucrReceiverDistrict.Selector = ucrSelectorMetadata
ucrReceiverDistrict.SetParameterIsString()
ucrReceiverDistrict.SetClimaticType("district")
ucrReceiverDistrict.bAutoFill = True
End Sub
Public Sub SetRCode(clsNewRSyntax As RSyntax, clsNewUpdateMetadataInfoFunction As RFunction, Optional bReset As Boolean = False)
If Not bControlsInitialised Then
InitialiseControls()
End If
clsRsyntax = clsNewRSyntax
clsUpdateMetadataInfoFunction = clsNewUpdateMetadataInfoFunction

ucrReceiverDistrict.SetRCode(clsUpdateMetadataInfoFunction, bReset, bCloneIfNeeded:=True)
ucrReceiverElavation.SetRCode(clsUpdateMetadataInfoFunction, bReset, bCloneIfNeeded:=True)
ucrReceiverLatitude.SetRCode(clsUpdateMetadataInfoFunction, bReset, bCloneIfNeeded:=True)
ucrReceiverLongititude.SetRCode(clsUpdateMetadataInfoFunction, bReset, bCloneIfNeeded:=True)
ucrReceiverStation.SetRCode(clsUpdateMetadataInfoFunction, bReset, bCloneIfNeeded:=True)
ucrSelectorMetadata.SetRCode(clsUpdateMetadataInfoFunction, bReset, bCloneIfNeeded:=True)
End Sub

Private Sub ucrReceiverLongititude_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverLongititude.ControlValueChanged, ucrReceiverStation.ControlValueChanged, ucrReceiverLatitude.ControlValueChanged, ucrReceiverElavation.ControlValueChanged, ucrReceiverDistrict.ControlValueChanged, ucrSelectorMetadata.ControlValueChanged
If Not (ucrReceiverElavation.IsEmpty OrElse ucrReceiverDistrict.IsEmpty OrElse ucrReceiverLatitude.IsEmpty OrElse ucrReceiverLongititude.IsEmpty OrElse ucrReceiverStation.IsEmpty) Then
clsRsyntax.AddToBeforeCodes(clsUpdateMetadataInfoFunction, 1)
Else
clsRsyntax.RemoveFromBeforeCodes(clsUpdateMetadataInfoFunction)
End If
End Sub
Copy link
Collaborator

Choose a reason for hiding this comment

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

one line space between the subs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@N-thony , we don't call this sub dialog any more in the main dialog. We have made the changes on the main dialog. Is there way I can remove the sub-dialog changes from this PR?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Vitalis95 I'm not sure about this. It was done usually by @lloyddewit

Comment on lines +25 to 27
Public clsRsyntax As New RSyntax
Public clsExportRinstatToBucketFunction, clsUpdateMetadataInfoFunction, ClsGcsAuthFileFunction, clsSummariesFunction As New RFunction
Public clsReforMattAnnualSummariesFunction, clsReformatCropSuccessFunction, clsReformatSeasonStartFunction, clsReformatTempSummariesFunction, clsReformatMonthlyTempSummaries As New RFunction
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we have them as Private variables?

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.

Reading metadata information to google buckets
4 participants