From 18be78fe532bec7eb8744092b5d069dde18072a7 Mon Sep 17 00:00:00 2001 From: Thomas Cram Date: Fri, 17 Jul 2026 11:59:16 -0600 Subject: [PATCH 01/10] Update BUFRSubsetForm to require 5-digit station IDs and adjust template rendering --- datasets/forms.py | 13 ++++++++----- .../datasets/custom-subset-page-d351000.html | 3 +-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/datasets/forms.py b/datasets/forms.py index fbccbd9d..44e84303 100644 --- a/datasets/forms.py +++ b/datasets/forms.py @@ -121,13 +121,16 @@ def __init__(self, *args, **kwargs): # Station IDs (comma-separated list of 5-digit WMO numbers) # ------------------------------------------------------------------ station0 = forms.CharField( - required=False, - max_length=5, - label='Station 1', + required=False, + min_length=5, + max_length=5, + label='Station IDs (comma-separated)', widget=forms.Textarea(attrs={ 'class': 'form-control stns', - 'rows': '4', 'tabindex': '1' - }), + 'rows': '4', + 'tabindex': '1', + 'id': 'station0', + }), ) # ------------------------------------------------------------------ diff --git a/datasets/templates/datasets/custom-subset-page-d351000.html b/datasets/templates/datasets/custom-subset-page-d351000.html index 1c0ff6b9..27247dc1 100644 --- a/datasets/templates/datasets/custom-subset-page-d351000.html +++ b/datasets/templates/datasets/custom-subset-page-d351000.html @@ -103,8 +103,7 @@

to search for station information in the WMO Oscar/Surface WIGOS metadata repository. - - + {{ form.station0 }}
From 3ae4ffe7fec23c3153613a2a24c34bf6f22807e5 Mon Sep 17 00:00:00 2001 From: Thomas Cram Date: Fri, 17 Jul 2026 12:00:26 -0600 Subject: [PATCH 02/10] Replace textarea for station IDs with form field in custom subset page --- datasets/templates/datasets/custom-subset-page-d461000.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/datasets/templates/datasets/custom-subset-page-d461000.html b/datasets/templates/datasets/custom-subset-page-d461000.html index 0662cc08..0efd81d0 100644 --- a/datasets/templates/datasets/custom-subset-page-d461000.html +++ b/datasets/templates/datasets/custom-subset-page-d461000.html @@ -102,8 +102,7 @@

to search for station information in the WMO Oscar/Surface WIGOS metadata repository. - - + {{ form.station0 }}
From 3314466344d291614fdd9b98de8458e3a44ddee8 Mon Sep 17 00:00:00 2001 From: Thomas Cram Date: Fri, 17 Jul 2026 12:10:01 -0600 Subject: [PATCH 03/10] Change input 'station0' to 'stationIDs' --- datasets/forms.py | 10 +++++----- datasets/static/datasets/js/BUFR_subset.js | 2 +- .../templates/datasets/custom-subset-page-d351000.html | 2 +- .../templates/datasets/custom-subset-page-d461000.html | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/datasets/forms.py b/datasets/forms.py index 44e84303..ef99201a 100644 --- a/datasets/forms.py +++ b/datasets/forms.py @@ -118,18 +118,18 @@ def __init__(self, *args, **kwargs): ) # ------------------------------------------------------------------ - # Station IDs (comma-separated list of 5-digit WMO numbers) + # Station IDs (comma-separated list of 5 or 6 digit WMO numbers) # ------------------------------------------------------------------ - station0 = forms.CharField( + stationIDs = forms.CharField( required=False, - min_length=5, - max_length=5, + min_length=5, + max_length=6, label='Station IDs (comma-separated)', widget=forms.Textarea(attrs={ 'class': 'form-control stns', 'rows': '4', 'tabindex': '1', - 'id': 'station0', + 'id': 'stationIDs', }), ) diff --git a/datasets/static/datasets/js/BUFR_subset.js b/datasets/static/datasets/js/BUFR_subset.js index bc595b88..d9901ffa 100644 --- a/datasets/static/datasets/js/BUFR_subset.js +++ b/datasets/static/datasets/js/BUFR_subset.js @@ -193,7 +193,7 @@ function checkStations() // check stations countValid = 0; // Count the valid entries - stationInput = document.getElementById("station0").value; + stationInput = document.getElementById("stationIDs").value; if (stationInput == "" || stationInput == null) { alert("Please enter at least one station ID or select a different spatial range option."); return false; diff --git a/datasets/templates/datasets/custom-subset-page-d351000.html b/datasets/templates/datasets/custom-subset-page-d351000.html index 27247dc1..9a6fd3a7 100644 --- a/datasets/templates/datasets/custom-subset-page-d351000.html +++ b/datasets/templates/datasets/custom-subset-page-d351000.html @@ -103,7 +103,7 @@

to search for station information in the WMO Oscar/Surface WIGOS metadata repository. - {{ form.station0 }} + {{ form.stationIDs }}
diff --git a/datasets/templates/datasets/custom-subset-page-d461000.html b/datasets/templates/datasets/custom-subset-page-d461000.html index 0efd81d0..74d61ebb 100644 --- a/datasets/templates/datasets/custom-subset-page-d461000.html +++ b/datasets/templates/datasets/custom-subset-page-d461000.html @@ -102,7 +102,7 @@

to search for station information in the WMO Oscar/Surface WIGOS metadata repository. - {{ form.station0 }} + {{ form.stationIDs }}
From 155fecf947750dfd3d6ceb39cac2abe54c90c0ed Mon Sep 17 00:00:00 2001 From: tcram Date: Fri, 17 Jul 2026 18:14:59 +0000 Subject: [PATCH 04/10] update tcram-test image version --- app-chart/values.yaml.tcram | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-chart/values.yaml.tcram b/app-chart/values.yaml.tcram index 06dddfd5..d61693ce 100644 --- a/app-chart/values.yaml.tcram +++ b/app-chart/values.yaml.tcram @@ -9,7 +9,7 @@ webapp: fqdnAPI: api.tcram.k8s.ucar.edu secretName: incommon-cert-tcram-gdex-webserver container: - image: hub.k8s.ucar.edu/tcram-gdex/gdex-web-portal:v29534790082 + image: hub.k8s.ucar.edu/tcram-gdex/gdex-web-portal:v29602964468 port: 8080 requests: memory: 4Gi From 3e158e49c0d5cfb594c8c768f6c92fb3b1b234ef Mon Sep 17 00:00:00 2001 From: Thomas Cram Date: Fri, 17 Jul 2026 12:50:42 -0600 Subject: [PATCH 05/10] Update BUFRSubsetForm to use CharField for station IDs and adjust templates to display label --- datasets/forms.py | 1 - datasets/templates/datasets/custom-subset-page-d351000.html | 1 + datasets/templates/datasets/custom-subset-page-d461000.html | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/datasets/forms.py b/datasets/forms.py index ef99201a..be63ba9f 100644 --- a/datasets/forms.py +++ b/datasets/forms.py @@ -123,7 +123,6 @@ def __init__(self, *args, **kwargs): stationIDs = forms.CharField( required=False, min_length=5, - max_length=6, label='Station IDs (comma-separated)', widget=forms.Textarea(attrs={ 'class': 'form-control stns', diff --git a/datasets/templates/datasets/custom-subset-page-d351000.html b/datasets/templates/datasets/custom-subset-page-d351000.html index 9a6fd3a7..d9dc20ec 100644 --- a/datasets/templates/datasets/custom-subset-page-d351000.html +++ b/datasets/templates/datasets/custom-subset-page-d351000.html @@ -103,6 +103,7 @@

to search for station information in the WMO Oscar/Surface WIGOS metadata repository. + {{ form.stationIDs.label_tag }} {{ form.stationIDs }} diff --git a/datasets/templates/datasets/custom-subset-page-d461000.html b/datasets/templates/datasets/custom-subset-page-d461000.html index 74d61ebb..e7943d3b 100644 --- a/datasets/templates/datasets/custom-subset-page-d461000.html +++ b/datasets/templates/datasets/custom-subset-page-d461000.html @@ -102,6 +102,7 @@

to search for station information in the WMO Oscar/Surface WIGOS metadata repository. + {{ form.stationIDs.label_tag }} {{ form.stationIDs }} From 2d28a740c5e466ae590f97c8e2d7f582ea41e197 Mon Sep 17 00:00:00 2001 From: tcram Date: Fri, 17 Jul 2026 18:53:35 +0000 Subject: [PATCH 06/10] update tcram-test image version --- app-chart/values.yaml.tcram | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-chart/values.yaml.tcram b/app-chart/values.yaml.tcram index d61693ce..6fc9fea2 100644 --- a/app-chart/values.yaml.tcram +++ b/app-chart/values.yaml.tcram @@ -9,7 +9,7 @@ webapp: fqdnAPI: api.tcram.k8s.ucar.edu secretName: incommon-cert-tcram-gdex-webserver container: - image: hub.k8s.ucar.edu/tcram-gdex/gdex-web-portal:v29602964468 + image: hub.k8s.ucar.edu/tcram-gdex/gdex-web-portal:v29605365712 port: 8080 requests: memory: 4Gi From 033d615937fbcda7ed808072bfb8e0283fe65cb5 Mon Sep 17 00:00:00 2001 From: Thomas Cram Date: Fri, 17 Jul 2026 13:02:50 -0600 Subject: [PATCH 07/10] Replace label_tag with custom label element for station IDs in subset form --- datasets/templates/datasets/custom-subset-page-d351000.html | 2 +- datasets/templates/datasets/custom-subset-page-d461000.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/datasets/templates/datasets/custom-subset-page-d351000.html b/datasets/templates/datasets/custom-subset-page-d351000.html index d9dc20ec..d52c384c 100644 --- a/datasets/templates/datasets/custom-subset-page-d351000.html +++ b/datasets/templates/datasets/custom-subset-page-d351000.html @@ -103,7 +103,7 @@

to search for station information in the WMO Oscar/Surface WIGOS metadata repository. - {{ form.stationIDs.label_tag }} + {{ form.stationIDs }} diff --git a/datasets/templates/datasets/custom-subset-page-d461000.html b/datasets/templates/datasets/custom-subset-page-d461000.html index e7943d3b..4f16272f 100644 --- a/datasets/templates/datasets/custom-subset-page-d461000.html +++ b/datasets/templates/datasets/custom-subset-page-d461000.html @@ -102,7 +102,7 @@

to search for station information in the WMO Oscar/Surface WIGOS metadata repository. - {{ form.stationIDs.label_tag }} + {{ form.stationIDs }} From 0eca5203157590f8aab23d719945bf1e5826f67b Mon Sep 17 00:00:00 2001 From: tcram Date: Fri, 17 Jul 2026 19:05:46 +0000 Subject: [PATCH 08/10] update tcram-test image version --- app-chart/values.yaml.tcram | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-chart/values.yaml.tcram b/app-chart/values.yaml.tcram index 6fc9fea2..6d66d628 100644 --- a/app-chart/values.yaml.tcram +++ b/app-chart/values.yaml.tcram @@ -9,7 +9,7 @@ webapp: fqdnAPI: api.tcram.k8s.ucar.edu secretName: incommon-cert-tcram-gdex-webserver container: - image: hub.k8s.ucar.edu/tcram-gdex/gdex-web-portal:v29605365712 + image: hub.k8s.ucar.edu/tcram-gdex/gdex-web-portal:v29606121846 port: 8080 requests: memory: 4Gi From 088ed552911ef7ccd0a9fed0cca535960d093cae Mon Sep 17 00:00:00 2001 From: Thomas Cram Date: Fri, 17 Jul 2026 15:16:32 -0600 Subject: [PATCH 09/10] Add ISPDSubsetForm and update related templates and JavaScript for spatial selection --- datasets/forms.py | 100 ++++++++ datasets/static/datasets/js/BUFR_subset.js | 15 +- datasets/static/datasets/js/ispdv4_subset.js | 227 ++---------------- .../datasets/custom-subset-page-d132002.html | 6 +- 4 files changed, 130 insertions(+), 218 deletions(-) diff --git a/datasets/forms.py b/datasets/forms.py index be63ba9f..f6c782c7 100644 --- a/datasets/forms.py +++ b/datasets/forms.py @@ -171,6 +171,106 @@ def clean(self): raise forms.ValidationError('Start date must not be later than end date.') return cleaned +class ISPDSubsetForm(forms.Form): + """ ISPD subset form for dataset d132002 """ + + SPATIAL_CHOICES = [ + ('-1', 'Choose a spatial subset preference'), + ('0', 'Select latitude/longitude region via map'), + ('1', 'Select location by station ID'), + ('2', 'Select location by location name'), + ] + OBSERVATION_TYPE_CHOICES = [ + ('RADIOSONDE', 'Radiosonde observations'), + ('DROPSONDE', 'Dropsonde observations'), + ('MARINE', 'Marine observations'), + ('SFC_STATION', 'Surface station observations'), + ('TC_BEST_TRACK', 'Tropical Cyclone Best Track observations'), + ] + COMPRESSION_CHOICES = [ + ('gz', '.gz (Gzip)'), + ('None', 'No compression'), + ] + + start_date = forms.DateField( + required=False, + label='Start Date', + input_formats=['%Y-%m-%d'], + widget=forms.TextInput(attrs={ + 'placeholder': 'YYYY-MM-DD', + 'size': '10', + 'maxlength': '10' + } + ), + ) + end_date = forms.DateField( + required=False, + label='End Date', + input_formats=['%Y-%m-%d'], + widget=forms.TextInput(attrs={ + 'placeholder': 'YYYY-MM-DD', + 'size': '10', + 'maxlength': '10' + } + ), + ) + grid_selection = forms.ChoiceField( + required=True, + choices=SPATIAL_CHOICES, + label='Spatial Subset Preference', + widget=forms.Select(attrs={ + 'class': 'custom-select', + 'id': 'gridSelectionMenu', + 'onchange': 'displayGridSelection(document.form.grid_selection.value)' + } + ), + ) + station_ids = forms.CharField( + required=False, + min_length=5, + label='Station IDs (comma-separated)', + widget=forms.Textarea(attrs={ + 'class': 'form-control stns', + 'rows': '4', + 'tabindex': '1', + 'id': 'stationIDs' + } + ), + ) + location_names = forms.CharField( + required=False, + label='Location Names (comma-separated)', + widget=forms.Textarea(attrs={ + 'class': 'form-control locs', + 'rows': '4', + 'tabindex': '1', + 'id': 'locationNames' + } + ), + ) + observation_types = forms.MultipleChoiceField( + required=False, + choices=OBSERVATION_TYPE_CHOICES, + label='Observation Types', + widget=forms.CheckboxSelectMultiple(attrs={'class': 'form-check-input'}), + ) + + dsid = forms.CharField(widget=forms.HiddenInput, required=False) + gindex = forms.IntegerField(widget=forms.HiddenInput, required=False, initial=1) + rtype = forms.CharField(widget=forms.HiddenInput, required=False, initial='S') + tlat = forms.CharField(widget=forms.HiddenInput, required=False) + blat = forms.CharField(widget=forms.HiddenInput, required=False) + llon = forms.CharField(widget=forms.HiddenInput, required=False) + rlon = forms.CharField(widget=forms.HiddenInput, required=False) + + def clean(self): + cleaned = super().clean() + start = cleaned.get('startDate') + end = cleaned.get('endDate') + if start and end and start > end: + raise forms.ValidationError('Start date must not be later than end date.') + return cleaned + def validate_dsid(value): if not re.match(r'^[a-z]{1}[0-9]{6}$', value): raise forms.ValidationError("Dataset ID format must be 'd123456'.") diff --git a/datasets/static/datasets/js/BUFR_subset.js b/datasets/static/datasets/js/BUFR_subset.js index d9901ffa..1ed2e026 100644 --- a/datasets/static/datasets/js/BUFR_subset.js +++ b/datasets/static/datasets/js/BUFR_subset.js @@ -514,19 +514,6 @@ function checkParameters() return true; } -/** - * function to show/hide google map - */ -function displayGoogleMap(act) -{ - if(act == 1) { - $("#mapselect").show(); - } else { - setSpaceValues(); - $("#mapselect").hide(); - } -} - /** * function to show appropriate spatial subsetting selection */ @@ -540,7 +527,7 @@ function displayGridSelection(value) // Google map lat/lon selection if (value == 0) { - displayGoogleMap(1); + $("#mapselect").show(); $("#stationSelect").hide(); } diff --git a/datasets/static/datasets/js/ispdv4_subset.js b/datasets/static/datasets/js/ispdv4_subset.js index 7250cfe0..f51ca5e3 100644 --- a/datasets/static/datasets/js/ispdv4_subset.js +++ b/datasets/static/datasets/js/ispdv4_subset.js @@ -117,7 +117,7 @@ function checkDates() { /** Validate and process spatial selection */ function checkSpatial() { - regionSelection = $('#regionSelectMenu').val(); + regionSelection = $('#gridSelectionMenu').val(); if (regionSelection == "-1" || regionSelection == null) { alert("Please select a spatial range option from the dropdown menu."); @@ -152,7 +152,7 @@ function checkStations() // check stations countValid = 0; // Count the valid entries - stationInput = document.getElementById("station0").value; + stationInput = document.getElementById("stationIDs").value; if (stationInput == "" || stationInput == null) { alert("Please enter at least one station ID or select a different spatial range option."); return false; @@ -260,7 +260,7 @@ function checkLatLon() var value, unit; i = 0; - if(form.mapdisplayed.value == 1) setSpaceValues(); + setSpaceValues(); max = goodCoordinate(form.tlat.value, true); if(max == 999) { @@ -490,139 +490,24 @@ function getTypes() return true; } -function regionSelectChange() +function displayGridSelection(value) { - var selectedValue = $('#regionSelectMenu').val(); - - if (selectedValue === "-1") { - hideRegionSelection(); - } else if(selectedValue == "1") { - displayGoogleMap(1); - } else if(selectedValue == "2") { - displayStationSelection(1); - } else if(selectedValue == "3") { - displayLocationSelection(1); - } -} - -/** Hide all region selection sections */ -function hideRegionSelection() -{ - $("#mapselect").hide(); - $("#manselect").hide(); - $("#stationSelect").hide(); - $("#locationSelect").hide(); - - $("form input[name='mapdisplayed']").val(0); - $("form input[name='mandisplayed']").val(0); - $("form input[name='latlondisplayed']").val(0); - $("form input[name='stationdisplayed']").val(0); - $("form input[name='locationdisplayed']").val(0); -} - -/** - * function to show/hide google map - */ -function displayGoogleMap(act) -{ - var mapdisp = $("#mapselect"); - var mandisp = $("#manselect"); - var stationdisp = $("#stationSelect"); - var locationdisp = $("#locationSelect"); - - if(act == 1) { - mapdisp.show(); - mandisp.hide(); - stationdisp.hide(); - locationdisp.hide(); - - document.form.mapdisplayed.value = 1; - document.form.mandisplayed.value = 0; - document.form.latlondisplayed.value = 1; - document.form.stationdisplayed.value = 0; - document.form.locationdisplayed.value = 0; - } else { - setSpaceValues(); - mapdisp.hide(); - mandisp.hide(); - stationdisp.hide(); - locationdisp.hide(); - - document.form.mapdisplayed.value = 0; - document.form.mandisplayed.value = 0; - document.form.latlondisplayed.value = 0; - document.form.stationdisplayed.value = 0; - document.form.locationdisplayed.value = 0; - } -} - -/** - * function to show/hide station ID selection - */ -function displayStationSelection(action) -{ - var stationdisp = $("#stationSelect"); - var locationdisp = $("#locationSelect"); - var mapdisp = $("#mapselect"); - var mandisp = $("#manselect"); - - if(action == 1) { - stationdisp.show(); - mapdisp.hide(); - mandisp.hide(); - locationdisp.hide(); - - document.form.latlondisplayed.value = 0; - document.form.mapdisplayed.value = 0; - document.form.mandisplayed.value = 0; - document.form.stationdisplayed.value = 1; - document.form.locationdisplayed.value = 0; - } else { - stationdisp.hide(); - mapdisp.hide(); - mandisp.hide(); - locationdisp.hide(); - - document.form.latlondisplayed.value = 0; - document.form.mapdisplayed.value = 0; - document.form.mandisplayed.value = 0; - document.form.stationdisplayed.value = 0; - document.form.locationdisplayed.value = 0; - } -} - -/** - * function to show/hide station ID selection - */ -function displayLocationSelection(action) -{ - var stationdisp = $("#stationSelect"); - var locationdisp = $("#locationSelect"); - var mapdisp = $("#mapselect"); - var mandisp = $("#manselect"); - - if(action == 1) { - locationdisp.show(); - mapdisp.hide(); - mandisp.hide(); - stationdisp.hide(); - - document.form.latlondisplayed.value = 0; - document.form.mapdisplayed.value = 0; - document.form.mandisplayed.value = 0; - document.form.stationdisplayed.value = 0; - document.form.locationdisplayed.value = 1; - } else { - locationdisp.hide(); - mapdisp.hide(); - mandisp.hide(); - stationdisp.hide(); - - document.form.latlondisplayed.value = 0; - document.form.mapdisplayed.value = 0; - document.form.mandisplayed.value = 0; - document.form.stationdisplayed.value = 0; - document.form.locationdisplayed.value = 0; + if (value === "-1") { + $('#mapselect').hide(); + $('#stationSelect').hide(); + $('#locationSelect').hide(); + } else if(value == "0") { + $('#mapselect').show(); + $('#stationSelect').hide(); + $('#locationSelect').hide(); + } else if(value == "1") { + $('#stationSelect').show(); + $('#mapselect').hide(); + $('#locationSelect').hide(); + } else if(value == "2") { + $('#locationSelect').show(); + $('#mapselect').hide(); + $('#stationSelect').hide(); } } @@ -708,22 +593,22 @@ function gather_request_info() lons = form.llon.value + ", " + form.rlon.value; getTypes(); comp = get_compress_info(); -// fmt = get_fmt_info(); fmt = "ascii"; rnote = "Date Limits : " + dates; rinfo = "dates=" + dates; - if(form.latlondisplayed.value == 1) { + gridSelection = $('[name="gridSelection"]').val(); + if(gridSelection == "0") { rnote += "\nLatitude Limits : " + lats + "\nLongitude Limits : " + lons; rinfo += "&lats=" + lats + "&lons=" + lons; - } else if (locations && form.locationdisplayed.value == 1) { - rnote += "\nLocations : " + locations; - rinfo += "&loc=" + locations; - } else if (stations && form.stationdisplayed.value == 1) { + } else if (gridSelection == "1") { rnote += "\nStation ID : " + stations; rinfo += "&stn=" + stations; + } else if (gridSelection == "2") { + rnote += "\nLocations : " + locations; + rinfo += "&loc=" + locations; } if(types){ @@ -771,66 +656,6 @@ function get_fmt_info() return "ascii"; } -/** - * Add additional fields to station ID form input - */ -function addStation() -{ - if (stationCounter == stationLimit) { - alert("You have reached the limit of " + stationCounter + " station inputs"); - } else if (stationCounter < stationLimit/2) { - var tbl = document.getElementById('stationTable'); - var lastRow = tbl.rows.length; - var row = tbl.insertRow(lastRow); - - // Left cell - var cellLeft = row.insertCell(0); -// var fontElem = document.createElement('font'); -// fontElem.style.fontSize="small"; -// fontElem.style.color="#000000"; -// fontElem.appendChild(document.createTextNode('Station '+(stationCounter+1)+' ')); -// cellLeft.appendChild(fontElem); - cellLeft.className="body"; - cellLeft.style.textAlign="left"; - cellLeft.appendChild(document.createTextNode('Station '+(stationCounter+1)+' ')); - - // Right cell - var cellRight = row.insertCell(1); - var elem = document.createElement('input'); - elem.type = 'text'; - elem.name = 'station' + stationCounter; - elem.id = 'station' + stationCounter; - elem.size = 6; - elem.maxlength = 6; - cellRight.appendChild(elem); - - // Add two more blank cells - var cellThree = row.insertCell(2); - cellThree.className="body"; - cellThree.style.textAlign="left"; - var cellFour = row.insertCell(3); - - stationCounter++; - } else { - var tbl = document.getElementById('stationTable'); - var thisRow = stationCounter-(stationLimit/2); -// var fontElem = document.createElement('font'); -// fontElem.style.fontSize="small"; -// fontElem.style.color="#000000"; -// fontElem.appendChild(document.createTextNode('Station '+(stationCounter+1)+' ')); -// tbl.rows[thisRow].cells[2].appendChild(fontElem); - tbl.rows[thisRow].cells[2].appendChild(document.createTextNode('Station '+(stationCounter+1)+' ')); - var elem = document.createElement('input'); - elem.type = 'text'; - elem.name = 'station' + stationCounter; - elem.id = 'station' + stationCounter; - elem.size = 6; - elem.maxlength = 6; - tbl.rows[thisRow].cells[3].appendChild(elem); - stationCounter++; - } -} - /** * Select all NCEP observation types */ diff --git a/datasets/templates/datasets/custom-subset-page-d132002.html b/datasets/templates/datasets/custom-subset-page-d132002.html index 05d97a79..35d77b75 100644 --- a/datasets/templates/datasets/custom-subset-page-d132002.html +++ b/datasets/templates/datasets/custom-subset-page-d132002.html @@ -124,8 +124,8 @@

look up station IDs in the ISPD version 4 inventory here. - - + + @@ -148,7 +148,7 @@

for London Heathrow Airport, London Gatwick Airport, and other observation records with "London" in the station name field. - + From da4f488784dfd4601bff90f6b5002beaa63a1efa Mon Sep 17 00:00:00 2001 From: Thomas Cram Date: Fri, 17 Jul 2026 15:50:38 -0600 Subject: [PATCH 10/10] Enhance ISPDSubsetForm initialization and update custom subset template to use form fields --- datasets/forms.py | 6 ++++- .../datasets/custom-subset-page-d132002.html | 27 +++++++++---------- datasets/views.py | 26 +++++++++++------- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/datasets/forms.py b/datasets/forms.py index f6c782c7..6732fb4b 100644 --- a/datasets/forms.py +++ b/datasets/forms.py @@ -192,6 +192,10 @@ class ISPDSubsetForm(forms.Form): ('None', 'No compression'), ] + def __init__(self, *args, **kwargs): + self.dsid = kwargs.pop('dsid', None) + super(ISPDSubsetForm, self).__init__(*args, **kwargs) + start_date = forms.DateField( required=False, label='Start Date', @@ -257,7 +261,7 @@ class ISPDSubsetForm(forms.Form): dsid = forms.CharField(widget=forms.HiddenInput, required=False) gindex = forms.IntegerField(widget=forms.HiddenInput, required=False, initial=1) - rtype = forms.CharField(widget=forms.HiddenInput, required=False, initial='S') + rtype = forms.CharField(widget=forms.HiddenInput, required=False, initial='T') tlat = forms.CharField(widget=forms.HiddenInput, required=False) blat = forms.CharField(widget=forms.HiddenInput, required=False) llon = forms.CharField(widget=forms.HiddenInput, required=False) diff --git a/datasets/templates/datasets/custom-subset-page-d132002.html b/datasets/templates/datasets/custom-subset-page-d132002.html index 35d77b75..7ad757a0 100644 --- a/datasets/templates/datasets/custom-subset-page-d132002.html +++ b/datasets/templates/datasets/custom-subset-page-d132002.html @@ -34,20 +34,19 @@

Dataset {{ subset.dsid }} - Submit a Subset Data Request

- - - - - - - - - - - - - - + + {# --- Hidden fields rendered directly from the form --- #} + {{ form.dsid }} + {{ form.gindex }} + {{ form.rtype }} + {{ form.tlat }} + {{ form.blat }} + {{ form.llon }} + {{ form.rlon }} + + {# minDate / maxDate feed the jQuery datepicker min/max – not user inputs #} + +
diff --git a/datasets/views.py b/datasets/views.py index a618ce6f..1018cc25 100755 --- a/datasets/views.py +++ b/datasets/views.py @@ -37,7 +37,7 @@ from gdexwebserver.utils import make_tempdir, remove_tempdir from dashboard.utils import get_user_email, is_internal_user -from .forms import DatasetRequestForm, BUFRSubsetForm +from .forms import DatasetRequestForm, BUFRSubsetForm, ISPDSubsetForm from rda_python_dsrqst.PgRDARqst import rda_request import logging @@ -706,23 +706,29 @@ def custom_subset(request, dsid): ctx.update({'page': d}) logger.info("Added dataset description context to custom subset page for dataset {}".format(dsid)) + initial_form_data = { + 'dsid': dsid, + 'gindex': subset_context.get('gindex', 1), + 'rtype': 'S', + 'startDate': subset_context.get('date_start', ''), + 'endDate': subset_context.get('date_end', ''), + 'compr': 'gz', + } if dsid in ['d351000', 'd461000']: ctx['form'] = BUFRSubsetForm( auto_id='%s', dsid=dsid, - initial={ - 'dsid': dsid, - 'gindex': subset_context.get('gindex', 1), - 'rtype': 'S', - 'startDate': subset_context.get('date_start', ''), - 'endDate': subset_context.get('date_end', ''), - 'compr': 'gz', - }, + initial=initial_form_data, + ) + if dsid == 'd132002': + ctx['form'] = ISPDSubsetForm( + auto_id='%s', + dsid=dsid, + initial=initial_form_data, ) return render(request, template, ctx) - def example_view(request, dsid): """Displays page to get code examples.""" if request.GET: