(Requires Repo Membership)
# | Database | Table Name | Total Records | Type | Access | Primary Keys | Archived S3 |
1 | wfx_ref_data | climate_region | 51 | Table | Public |
Country, State, Climate_Region
| YES |
1 | wfx_ref_data | country_names | 268 | Table | Public |
Country_Name
| YES |
2 | wfx_ref_data | dma | 210 | Table | Public |
DMA_Code
| YES |
3 | wfx_ref_data | dma_mapping | 40891 | View | Public |
None
| NO |
4 | wfx_ref_data | holidays | 104 | Table | Public |
Country, Holiday_Date
| YES |
5 | wfx_ref_data | location | 50891 | View | Public |
None
| YES |
6 | wfx_ref_data | noaa_coopid_mapping | 7735 | View | Public |
None
| NO |
7 | wfx_ref_data | obs_stn_mapping | 41275 | View | Public |
None
| NO |
8 | wfx_ref_data | season | 10 | Table | Public |
Season_ID
| YES |
9 | wfx_ref_data | season_dates | 1122 | Table | Public |
Country, Climate_Region, Season_Dates
| YES |
10 | wfx_ref_data | state_names | 65 | Table | Public |
None
| YES |
11 | wfx_ref_data | zip_type | 40886 | Table | Public |
LocationID
| YES |
12 | wfx_ref_data | loc_type | 21 | Table | Public |
LocID
| YES |
13 | wfx_ref_data_private | location_master_wte | 2968035 | Table | Private |
twc_loc_id, loc_type, country_cd
| YES |
14 | wfx_ref_data_private | location_master_copy | 2917693 | Table | Private |
twc_loc_id, loc_type, country_cd
| YES |
15 | wfx_ref_data_private | noaa_coop_obs_stn_atl | 2112 | Table | Private |
None
| YES |
16 | wfx_ref_data_private | noaa_coopid_mapping_union | 78841 | View | Private |
None
| NO |
Table 1: LOCATION (View: Public)
#Create view:
stmt = """select
twc_loc_id as location_id,
loc_type as loc_id_type,
city_nm as city,
st_cd as state,
country_cd as country
from wfx_ref_data_private.location_master_wte
where country_cd in("US", "GB") and loc_type = '4'"""
#View DDL
queryqc('describe wfx_ref_data.location')
#sample 3 records query from created view
queryqc("""select * from wfx_ref_data.location limit 3""")
2. DMA (Table: Public)
#Table DDL
queryqc('describe wfx_ref_data.dma')
#Sample 3 Records from Tbl
queryqc('select * from wfx_ref_data.dma limit 3')
3. DMA_MAPPING (View: Public)
stmt = """select
twc_loc_id as location_id,
dma_cd as dma_code
from wfx_ref_data_private.location_master_wte
where (country_cd in('US','GB') and loc_type = '4' and dma_cd is not null)"""
#View DDL
queryqc('describe wfx_ref_data.dma_mapping')
#Sample 3 Records from View
queryqc('select * from wfx_ref_data.dma_mapping limit 3')
4. OBS_STN_MAPPING (View: Public)
stmt = """select
twc_loc_id as location_id,
country_cd as country,
obs_stn as obs_stn,
sec_obs_stn as obs_stn_sec,
tert_obs_stn as obs_stn_ter
from wfx_ref_data_private.location_master_wte
where (loc_type='4' and country_cd in('US', 'GB'))"""
#View DDL
queryqc('describe wfx_ref_data.obs_stn_mapping')
#Sample 3 records from view
queryqc('select * from wfx_ref_data.obs_stn_mapping limit 3')
5. NOAA_COOPID_MAPPING (View: Public)
Step 1: Upload external Excel File from ATL to fill missing obs_stn that are not present in locmaster
Step 2: Create helper view in wfx_ref_data_private called noaa_coopid_mapping_union
Step 3: Create final view in wfx_ref_data called noaa_coopid_mapping
for union
#Step 1: Load external file from ATL
#Step 2: Create noaa_coopid_mapping_union helper in private using excel from above and locmasterwte
stmt = """select distinct obs_stn as obs_station_id, twc_loc_id as coop_id
from wfx_ref_data_private.location_master_wte
where loc_type = '6' and country_cd = 'US'
union (
select * from wfx_ref_data_private.noaa_coop_obs_stn_atl
)"""
#Step 3: Create final view from distinct query
stmt = """select distinct * from wfx_ref_data_private.noaa_coopid_mapping_union where obs_station_id is not null"""
#View DDL
queryqc('describe wfx_ref_data.noaa_coopid_mapping')
#Sample 3 records from final view
queryqc('select * from wfx_ref_data.noaa_coopid_mapping limit 3')
6. CLIMATE_REGION (Table: Public)
Note: Need to Add International Data
#Table DDL
queryqc('describe wfx_ref_data.climate_region')
#Sample 3 Records from Table
queryqc('select * from wfx_ref_data.climate_region limit 3')
7. SEASON (Table: Public)
Note: Need to Add International Data
#Table DDL:
queryqc('describe wfx_ref_data.season')
#Sample * Records from Table
queryqc('select * from wfx_ref_data.season')
8. SEASON_DATES (Table: Public)
Note: Need to Add International Data
#Table DDL
queryqc('describe wfx_ref_data.season_dates')
#sample records
season_dates_df[:3]
9. HOLIDAYS (Table: Public)
Note: Need to Add International Data
#Table DDL
queryqc('describe wfx_ref_data.holidays')
#Sample 3 Records from Table
queryqc('select * from wfx_ref_data.holidays limit 3')
10. STATE_NAMES (Table: Public)
#Table DDL
queryqc('describe wfx_ref_data.state_names')
#Sample 3 Records from Table
queryqc('select * from wfx_ref_data.state_names limit 3')
11. ZIP_TYPE (Table: Public)
#Table DDL
queryqc('describe wfx_ref_data.zip_type')
#Sample 3 Records
queryqc('select * from wfx_ref_data.zip_type limit 3')
12. LOCATION_TYPE (Table: Public)
#Tbl DDL
queryqc('describe wfx_ref_data.loc_type')
#Records from Table
queryqc("""select CAST(loc_id_type as signed integer) as loc_id_type, location_desc as loc_desc
from wfx_ref_data.loc_type order by loc_id_type asc""")